wkextension

What is the equivalent of UIApplication.sharedApplication().delegate in WatchKit?

你。 提交于 2019-12-02 04:02:07
问题 In an iOS application, you can obtain a reference to the shared app delegate by: Swift: let delegate = UIApplication.sharedApplication().delegate as! AppDelegate Objective-C: AppDelegate *delegate = [[UIApplication sharedApplication] delegate]; In a WatchKit2 App Extension there is a similar App Delegate and I want to obtain a reference to it in a view controller to access shared resources in the app, such as the ManagedObjectModel and PersistentStoreCoordinator for the Core Data stack, that