Crash when converting a multi-dimensional Swift array to an NSArray

Originator:roop
Number:rdar://17519894 Date Originated:01-Jul-2014
Status:Closed Resolved:02-Oct-2014
Product:Developer Tools Product Version:Xcode 6 Beta 2
Classification:Bug Reproducible:Always
 
Summary:
When running a Swift program that involves converting a multi-dimensional Swift array (i.e. a Swift array that has each element as a Swift array) to an NSArray, the program compiles but crashes on execution.

Steps to Reproduce:
Run swift -i -sdk <simulator_sdk_path> on the following program:

~~~~
struct SomeStruct {
    var value: Int = 0
}

let a: NSArray = [Array<SomeStruct>(), Array<SomeStruct>()]
~~~~

Expected Results:
The program should execute.

Actual Results:
The program crashes when executing.

Version:
XCode 6.0 Beta 2 (6A216f)

Notes:


Configuration:


Attachments:

Comments

roop:

I can confirm that this is addressed in Xcode 6.1 GM (6A1042b). The code given in the description doesn't work anymore because Swift structs cannot be normally bridged to Obj-C. The code works with a class in place of a struct, and I am able to enumerate the sub-array objects of the NSArray. This issue has been verified as resolved and can be closed.

Apple Developer Relations:

Engineering has provided the following information:

We believe this issue has been addressed in the latest Xcode 6.1 beta.

This pre-release version of the Xcode 6.1 developer tools is required when developing for OS X Yosemite, and includes the Swift programming language. Xcode 6.1 beta runs on OS X Mavericks and OS X Yosemite Developer Preview.

Xcode 6.1 beta - Build 6A1042b

https://developer.apple.com/xcode/downloads/

Please provide your response or results by updating your bug report.


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!