Reputation: 15002
I have a swift array
var items: [String] = []
How to deep copy a __NSCFArray
arry into items
Thanks
Upvotes: 0
Views: 1641
Reputation: 21144
You know what, NSArray can be simply changed to the swift array using swift functions as?. And yes it will be able to use all the swift functions.
Take this code as an example,
let allPeople: NSArray = ["Jack", "Jill", "Johnes"]
if let theSwiftArray = allPeople as? [String]{
let counts = theSwiftArray.map(
{(a: String) -> Int in
return countElements(a)
}
)
println(counts)
}
I hope this helps for you.
Upvotes: 3