Working working with a SwiftUI Architecture WatchOS app, if you want to use ExtensionDelegate you need to create your own. I have done this, but when I try to actually access the delegate in the code, I am getting the following error message Could not cast value of type SwiftUI.ExtensionDelegate' (0x7fff8441b480) to 'TestMe_WatchKit_Extension.ExtensionDelegate' (0x10c3b36d0).
I have defined the ExtensionDelegate as -
in my @main - I have the following:
When I try to access the delegate within another class, not via @EnvironmentObject, but via - let delegate = WKExtension.shared().delegate as! ExtensionDelegate I get the above error.
I have defined the ExtensionDelegate as -
Code Block class ExtensionDelegate: NSObject, WKExtensionDelegate { var meetingStatistics: MeetingStatistics = MeetingStatistics() }
in my @main - I have the following:
Code Block @main struct WatchApp: App { @WKExtensionDelegateAdaptor(ExtensionDelegate.self) var delegate // code }
When I try to access the delegate within another class, not via @EnvironmentObject, but via - let delegate = WKExtension.shared().delegate as! ExtensionDelegate I get the above error.