Closed lazarte closed 7 years ago
Hey, take a look at this sample Watch API project.
Notice how you need to set the WatchEntityDelegate
class ViewController: UIViewController {
fileprivate var graph: Graph!
fileprivate var watch: Watch<Entity>!
open override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .white
prepareGraph()
prepareWatch()
}
}
extension ViewController {
fileprivate func prepareGraph() {
graph = Graph()
}
fileprivate func prepareWatch() {
watch = Watch<Entity>(graph: graph).for(types: "User").has(tags: "new").member(of: "admin").where(properties: "age")
watch.delegate = self
}
}
extension ViewController: WatchEntityDelegate {
@objc
func watch(graph: Graph, inserted entity: Entity, source: GraphSource) {
}
}
If you have any further question for this issue, please reopen the issue. Thank you!
Trying to implement a watch for the Entity. Tried to insert and delete entity but the watch delegate doesn't trigger. Please see below code.
Can someone give me an example on how to achieve the watch for the specific entity.