An iOS runtime library for VGG that supports both UIKit and SwiftUI.
erDiagram
VggExample 1--1 VggRuntime: use
VggRuntime 1--1 VggContainer: use
Item | Description |
---|---|
VggExample | The application using VggRuntime |
VggRuntime | Vgg iOS Framework |
VggContainer | Vgg c++ library |
- Build VggContainer.
- Build VggRuntime.Framework. Open the Vgg.xcworkspace in XCode and select the VggRuntime scheme.
- Importing VggRuntime. Add the following to the top of your file where you utilize the VggRuntime.
import VggRuntime
- Setup VggViewModel and use VggView.
struct VggCounter: View {
var body: some View {
if let filePath = Bundle.main.path(forResource: "counter",
ofType: "daruma",
inDirectory: "Assets") {
let vggViewModel = VggViewModel(filePath: filePath)
return vggViewModel.view()
} else {
return Text("Please provide a vgg file")
}
}
}
class CounterViewController: UIViewController {
var vggView: VggView {
let filePath = Bundle.main.path(forResource: "counter",
ofType: "daruma",
inDirectory: "Assets")!
let vggViewModel = VggViewModel(filePath: filePath)
return vggViewModel.createVggView()
}
override func viewWillAppear(_ animated: Bool) {
view.addSubview(vggView)
vggView.frame = view.bounds
}
}
You can run our iOS example app in this repository, open the Vgg.xcworkspace in XCode and select the VggExample scheme.