Appgix Appgix - 2 years ago 92
Swift Question

How can I add an Object to a NSOrderedSet at the last position?

How the Title says - I want to be sure that the object is on the last position but I cant find any functions for

. Is it possible to set it simply at

Answer Source

NSOrderedSet is immutable. You'll need NSMutableOrderedSet, in particular, you'll want to use addObject(_:), such as:


NSOrderedSet and NSMutableOrderedSet are both a part of the Foundation framework, and do not conform to the CollectionType protocol, so you cannot use the [] operator like in your question.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download