[quote='812537022, fmoraes, /thread/767346?answerId=812537022#812537022, /profile/fmoraes'] I was not expecting a cast to cause this threading violation message [/quote] It’s certainly weird, but its not hard to see how it could happen. If the cast ‘spins up’ the Objective-C class then its +initialize will run and that can do all sorts of odd things. I shoulda asked about this earlier, but what’s the big picture here? This pattern of searching the class list for all the subclasses of a class, or all the classes that conform to a protocol, is not something we generally do on Apple platforms. That’s for exactly the reason you’re bumping into here: The dynamic nature of the Objective-C runtime can result in unexpected side effects. Share and Enjoy — Quinn “The Eskimo!” @ Developer Technical Support @ Apple let myEmail = eskimo + 1 + @ + apple.com
Topic:
Programming Languages
SubTopic:
Swift
Tags: