简体   繁体   中英

Using delegates in apple watch

I don't know why it's crashing when I am trying to create an object of Controller.

func pushScreen() {
        var context = SelectModeInterfaceController()
        context.delegate = self
        pushController(withName: "SelectModeInterface", context: nil)    
}

I have two screens A and B. I want to send some data from A to B and B to A. It's pretty simple to send the data from A to B using context while B to A seems something different. I have knowledge about how to use delegates in iOS but in watchKit it seems different. If anybody has come up with the solution please share.

I create an singleton class which is just for the purpose of data sharing. Send the instance of this class, say created in A, to B using context. Updates that B makes will remain after B is dismissed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM