App has contentid
coming in as a number string from a json file:
let contentid: AnyObject! = jsonFeed[\"contentid\"]
let stream:Dictionary = [
The values you want to sort are actually strings and not numbers, thus the strange sort order. For Swift there exist an initializer init(key:ascending:selector:)
of NSSortDescriptor
and thus you can use
selector: "localizedStandardCompare:"
as described for example at nshipster.com/nssortdescriptor
The localizedStandardCompare:
gives you a Finder like sorting of string values in a way that numbers are sorted naturally as you would sort numbers. So 1,...,9,10,...,99, 100 etc.