In CoreData I have defined an unordered to-many relationship. This relationship is defined in Swift like this:
@NSManaged var types : NSMutableSet
However, to use Swift at it's best, I want to use a normal Swift array like Type[]
. However, CoreData forces me to use NS(Mutable)Set
. How can I type-cast / convert the NSSet
to Array<Type>[]
?
types.allObjects()
– MonsterNSSet
can be convertedNSArray
and the solution is the same from that point. – FloristArray
type and theNSArray
class., and (...)in Swift code, you can pass anArray
value to a method expecting anNSArray
object. You can also cast between a bridged type and its counterpart., I guess that is quite clear statement, source: developer.apple.com/library/prerelease/mac/documentation/Swift/…, and you are welcome! – Florist