Gavin McKenzie

78 Followers
169 Following
212 Posts

iOS contract developer since 2010, preceded by a 20 year career as a commercial software developer and architect, and a few years at Adobe. Also learning street photography with a FujiFilm X-Pro 3. Still love my #AppleNewton.

Lived in Ottawa for 25 years. Moved to Toronto in 2017.

LinkedInhttps://www.linkedin.com/in/gavinmckenzie

I can work around the “cannot cross actor boundary” warning by placing notification handling in a separate class not isolated to MainActor, but I’m still left with a warning of potential data races. The warning is valid in theory, but in practice my notifications are posted from the main actor and no races will occur. I’d still like to not have this warning, and I’m not thrilled about having to carve my notification handling into a separate class.

#swift #swiftui

For a concrete example, this is what I’m talking about. I subclass UIWindow which is defined as a MainActor class and I want to listen to a notification. In my notification handling code I want to inspect the object property of the notification.
#swift #swiftUI