Sorting NSArray containing NSDate objects

后端 未结 3 1146
暗喜
暗喜 2020-12-11 22:06

I have an array containing NSDate objects. With Objective-C, I am able to sort this array by using:

NSArray *array = [unsortedArray sortedArrayU         


        
3条回答
  •  独厮守ぢ
    2020-12-11 22:40

    Using the native Array type in Swift. If you are interfacing with legacy code from ObjC, use this:

    let array = unsortedArray.sortedArrayUsingSelector("compare:")
    

提交回复
热议问题