Swift 4.2 source compatibility

I just opened my project with Xcode 10 and I can see a bunch of compiler errors.
I'm happy doing the changes to support Swift 4.2, but I just wondered if it's worth to raise JIRA tickets for it.

One of the issues I see is an exposed "id" from Objective-C can't be casted with "as" to NSString anymore.


Is this a expected breaking change or should I raise a issue for it?
And in the more general case, is there an easy way to know what are expected source breaking changes?

id could never be converted to NSString with as, so something else must be going on. If you can provide your project, please do file a bug report!

1 Like


That "label.text" that you see in the screenshoot comes from TTTAttributedLabel that redefines the UILabel property.

My project is quite large and from a private company, but I can try if it happens in a sample project with that library.

Ah, this is a known change: previously if there were multiple properties with the same name, one would get picked pretty much at random. Now the compiler tries to choose properly (though it seems to be failing, since you provided type context with ! and as String). Please do file a bug if you can reproduce it!

I created a sample project with the issue. Is attached in https://bugs.swift.org/browse/SR-7997
I hope it helps ^^