-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathHybridViewModelInstance.swift
More file actions
46 lines (36 loc) · 2.03 KB
/
Copy pathHybridViewModelInstance.swift
File metadata and controls
46 lines (36 loc) · 2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import RiveRuntime
class HybridViewModelInstance: HybridViewModelInstanceSpec {
let viewModelInstance: RiveDataBindingViewModel.Instance?
init(viewModelInstance: RiveDataBindingViewModel.Instance) {
self.viewModelInstance = viewModelInstance
}
var instanceName: String { viewModelInstance?.name ?? "" }
func numberProperty(path: String) throws -> (any HybridViewModelNumberPropertySpec)? {
guard let property = viewModelInstance?.numberProperty(fromPath: path) else { return nil }
return HybridViewModelNumberProperty(property: property)
}
func stringProperty(path: String) throws -> (any HybridViewModelStringPropertySpec)? {
guard let property = viewModelInstance?.stringProperty(fromPath: path) else { return nil }
return HybridViewModelStringProperty(property: property)
}
func booleanProperty(path: String) throws -> (any HybridViewModelBooleanPropertySpec)? {
guard let property = viewModelInstance?.booleanProperty(fromPath: path) else { return nil }
return HybridViewModelBooleanProperty(property: property)
}
func colorProperty(path: String) throws -> (any HybridViewModelColorPropertySpec)? {
guard let property = viewModelInstance?.colorProperty(fromPath: path) else { return nil }
return HybridViewModelColorProperty(property: property)
}
func enumProperty(path: String) throws -> (any HybridViewModelEnumPropertySpec)? {
guard let property = viewModelInstance?.enumProperty(fromPath: path) else { return nil }
return HybridViewModelEnumProperty(property: property)
}
func triggerProperty(path: String) throws -> (any HybridViewModelTriggerPropertySpec)? {
guard let property = viewModelInstance?.triggerProperty(fromPath: path) else { return nil }
return HybridViewModelTriggerProperty(property: property)
}
func imageProperty(path: String) throws -> (any HybridViewModelImagePropertySpec)? {
guard let property = viewModelInstance?.imageProperty(fromPath: path) else { return nil }
return HybridViewModelImageProperty(property: property)
}
}