In an iOS or OS X Framework, which contains common code for both it's App, and app Extensions, is there a way to detect if the code is being run under the main app, or one of it's extensions? Specifically I'd like to detect if the framework is being used as part of a WatchKit extension as opposed to within the iPhone part of the App.
UIDevice.currentDevice
always returns the iPhone as that is what is running the code. I believe I could check if WKInterfaceDevice
exists, but that doesn't seem too elegant.
Aucun commentaire:
Enregistrer un commentaire