core data - Convert NSSet to Swift Array -


in coredata have defined unordered to-many relationship. relationship defined in swift this:

@nsmanaged var types : nsmutableset 

however, use swift @ it's best, want use normal swift array type[]. however, coredata forces me use ns(mutable)set. how can type-cast / convert nsset array<type>[]?

as of xcode 7.2 swift 2.1.1

actually, found out trial that:

@nsmanaged var types : set<type> 

works fine.

the fact coredata generates somethink like:

@nsmanaged var types : nsset 

when creating nsmanagedobject subclass editor. wondering if there not verbose method use filter method without casting. swift supposed bridge automatically between nsset, nsarray , counterparts. tried declaring directly set , works.

answering question, converting array becomes trivial:

array(types) 

Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -