ClassyKit / Classy

Expressive, flexible, and powerful stylesheets for UIView and friends.
http://classykit.github.io/Classy/
MIT License
740 stars 76 forks source link

Crash when working with Swift 3 classes #115

Closed rickbdotcom closed 8 years ago

rickbdotcom commented 8 years ago

I just encountered an exception when I upgraded my project to Swift 3.

"[_SwiftValue primitiveType]: unrecognized selector sent to instance" in CASStyler.m on "switch (argDescriptor.primitiveType)"

The crash is on a UI element I defined in Swift code. For some reason CASPropertyDescriptor is of type "SwiftValue" in this case. Appears to have something to do with "Any" changes in Swift 3: https://developer.apple.com/swift/blog/?id=39

Specifically: "If you see errors like unrecognized selector sent to _SwiftValue, that indicates that Objective-C code is trying to invoke a method on an opaque Swift value type, and you may need to manually box that value in an instance of the class the Objective-C code expects."

I'll dig into this further and see if I can figure out a fix.

rickbdotcom commented 8 years ago

OK I figured it out, not a bug in Classy. In my custom UIButton class, I was defining custom argument descriptors. With Swift 3, I'm going to need to box those so they come out as proper Obj-C classes when the Classy code interacts with them.