TimeZonePicker
TimeZonePicker copied to clipboard
SwiftUI + License for JSON?
Hi,
For a project I'm working on, I need a SwiftUI timezone picker and was considering adapting your code/JSON database file to SwiftUI. I haven't seen anything that states the JSON came from another source, so I'm assuming that the answer to this is 'yes', but just in case I wanted to confirm that the CitiesAndTimeZones.json file is licensed under Apache 2.0 with the rest of the code?
Thanks, Malcolm
Hey man, sure thing! If you like you could do it over the top of this library and raise a PR, then I can update the version to 2.0 and mark iOS support up to 13.0 for that version and up.
Would be good to have this in SwiftUI, I wasn't very good at coding the UI when I did this lib so would be great to improve it.
The json file is an extract from iOS or MacOS. I remember finding a way to extract that and getting the file that way, so I believe if it's public like that you should be free to use it.
Ok great, thanks! It may take a few days but I'll try to work on a SwiftUI implementation and see if I can do it as a fork/PR!
I was able to spend some time today working on it. So far, I've got a view with a label meant to display the currently selected time zone, and a button you can click to open a "search for city" view. Here, you can search for the city you want, and a list of matches shows up below. I haven't yet figured out how to get selection to work, but hopefully that'll come soon.
Here's a GIF of what I've got so far running in my macOS app. (The TimeZonePicker top-level view is where it says "None" with the "Select..." button next to it.) Before I do the PR, I'm hoping to confirm that it works on iOS as well.

@gligorkot Hi! Thanks for the project! Are you sure we can use the JSON file in our app?
Hey @thomasmo3, I can't say for sure, but I've released an app with this in it and it has been accepted on the App Store, so I can't see why it would be an issue for others.
Thank you! The JSON file is very useful.