title: Swift: removing an object from NSOrderedSet
body: <p><a href="https://i.stack.imgur.com/Rn5jn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Rn5jn.png" alt="enter image description here"></a>I found that a workaround to remove an object from NSOrderedSet is to remove it from its mutable copy. After fixing XCode's warnings that's the code I have:</p>
  
  <pre><code>let tempSet: NSMutableOrderedSet? = playset!.musicItems!.mutableCopy as? NSMutableOrderedSet
          tempSet!.remove(musicItem)
          playset!.musicItems = tempSet
  </code></pre>
  
  <p>But it gives me an error EXC_BAD_INSTRUCTION.
  How can I fix it?</p>