Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sort firmwares in order they are released #17

Open
nullpixel opened this issue Jan 2, 2017 · 3 comments
Open

Sort firmwares in order they are released #17

nullpixel opened this issue Jan 2, 2017 · 3 comments

Comments

@nullpixel
Copy link
Owner

Quiet hard to sort an Array of Strings, might start using Core Data to fetch and get the firmwares, then sort them by date.

Could this tie in with @betareleases?

@benjibobs
Copy link
Contributor

benjibobs commented Jan 3, 2017

This can be done through strings

I have made a formatter for the dates provided by the api you use to scrape the info below, and then sorted the array based on dates

let formatter = DateFormatter()
formatter.locale = Locale(identifier: "US_en")
formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss'Z'"
let date = formatter.date(from: "2014-09-19T17:54:02Z") //example


dates.sort({$0.date.timeIntervalSinceNow > $1.date.timeIntervalSinceNow}) //where dates is the array of firmwares

@nullpixel
Copy link
Owner Author

That's the issue here, the API doesn't return a date :/

@benjibobs
Copy link
Contributor

benjibobs commented Jan 3, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants