I'm using CocoaPods to import some things. Right now I'm trying to use TTTAttributedLabel, which is a rich subclass of UILabel, allowing for URL-clicking etc.
Now, I'm having trouble getting my app to recognise that my labels are actually instances of TTTAttributedLabel, and not regular UILabel's.
In my .xib, I have dragged a regular UILabel into my view, then edited the class of the label like this:
It did autocomplete the name for me, so I know it knows about the class. Then, I have dragged a connection from the xib to the view's class, like this:
It specifies itself as a TTTAttributedLabel automatically, because it recognises that that's what it is, or else it would've said UILabel.
Since I've specified use_frameworks! in my podfile, I have to import the class, so in the top of my view's class, I have import TTTAttributedLabel.
Now, when I try to use the label, it autocompletes likes this:
With the correct class, TTTAttributedLabel.
But when I do this:
print("labBody: ", labBody)
it prints out this:
labBody: <UILabel: 0x7fa754c86710; frame = (16 459; 42 21); text = 'Label'; opaque = NO; autoresize = RM+BM; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x60000029cf20>>
thinking it's a UILabel. If I try to access any of the TTTAttributedLabel-specific variables or functions, it still autocompletes them for me:
labBody.enabledTextCheckingTypes = NSTextCheckingResult.CheckingType.link.rawValue
But when using these on runtime, the entire app crashes, saying this:
-[UILabel setEnabledTextCheckingTypes:]: unrecognized selector sent to instance 0x7fdfc7c59300
Am I blind? Why is this not working? This is what I've always been doing. I might be having a hard Tuesday.. I have tried all the regular stuff, cleaning, deleting derived data, restarting Xcode, deleting the app from the device before running again..
I have even used TTTAttributedLabel before, I know it works. The only thing that's new is that this is my first time using use_frameworks!.. Does that affect the .xib? Making it unable to know about the subclass, or something..?

I have no idea exactly why this worked, but I assume it has something to do with this pod being in Objective-C and something about binding and loading Obj-C stuff..
Anyway, all I had to do was to wrap the object in a new local class.
and then change the class of my labels in the .xib-file to this class instead of
TTTAttributedLabel(and the outlets in my view's class, obviously).No need to do anything else than creating this class, it doesn't need to contain anything.
I did read something about setting a flag, like a
load ObjC-flag, I didn't try it. I thought that that solution might also load a lot of other Object-C stuff I didn't need/want to load..