 <pre><code>func itemMutableArray() -&gt; NSMutableArray { return NSMutableArray(array: (item.allObjects as! [Item]).sorted{ $0.date.compare($1.date) == NSComparisonResult.OrderedAscending } ) } </code></pre>