Created
          July 27, 2015 04:10 
        
      - 
      
- 
        Save NicholasTD07/79c1162a016ca1709cf4 to your computer and use it in GitHub Desktop. 
    Sort Swift array by NSDate
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | sturct Post { | |
| let content: String | |
| let createdAt: NSDate | |
| } | |
| var posts: [Post] = [] | |
| // getMorePosts -> [Post] | |
| posts.extend(getMorePosts()) | |
| posts.sort { $0.createdAt.timeIntervalSinceNow > $1.createdAt.timeIntervalSinceNow } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment