Initing an NSObject with a generic worked in Xcode 10.1 and not 10.2

Greetings all, I had some success asking question here in the past (under the Lucas_Jordan, who I cannot now access anymore, but never-mind:), so thanks in advance for your help.

Also not sure if this is the right place but... enough preamble.

I have attached a playground that works in Xcode 10.1 and not in Xcode 10.2. Basically there is a function that creates a new object based on the generic type used.

This is used heavily in a project I maintain to handle serialization and deserialization of a mix of NSObjects and vanilla Swift objects.

Also, I am calling this a bug because the object that comes back from the function causes a EXC_BAD_ACCESS regardless of if let and what not.

Here is a link the playground, since I guess we can't upload those here:

Thanks!

Sure looks like a bug to me. Please file at https://bugs.swift.org!

Created:
https://bugs.swift.org/browse/SR-10224

I'll post any workarounds I come up with here.

Thanks!

1 Like

I just checked to see if this is fixed in Xcode 10.3 and it is not. Also the SR-10224 us marked as resolved... but it is not. Any suggestions how to get this issue looked at again?

Its resolved on master (and perhaps on 5.1 as well, but I am not sure). You can verify by downloading a master and/or Swift 5.1 development snapshot from Swift.org - Download Swift

Are the changes in Swift 5.1 development snapshot expected to be in Xcode 11?

Yeah, the current Xcode 11 beta should have all changes in Swift 5.1 up till a certain point.

1 Like

I installed Xcode 10.2.1 and installed Swift tool chain 5.0.2 Release 2019-07-15 (a) and this issue is not resolved. Should I create a new ticket, or can someone reopen SR-10224 for me? thanks!

Just noticed there is a 5.1... trying that now...

So the 5.1 toolchain claims to not be compatible with playgrounds. I tried in Xcode 10.2.1 and Xcode 10.3, no luck.

Any suggestions how I can test this feature with the 5.1 toolchain?

What do you mean by "not be compatible with playgrounds"? I am able to use a development toolchain with Playgrounds just fine. What's the specific error you're getting?

You can also test with Xcode 11 beta, which ships with a 5.1 toolchain.

The image shows the error I get when I try and run the playground with the 5.1 toolchain I downloaded today.

Downloading Xcode 11 beta 5 now....

Ok, after much downloading, I have confirmed the issue resolved in Xcode 11 Beta 5 using the Xcode 11 toolchain that came with that download. Few! this is a big one for me :)

Thanks for the help.
-Lucas

1 Like