lucasmontano / openweathermap-ios

Weather, everybody wants to know how it is going to be during the week. Will it be rainy, windy, or sunny? Luckily for us, in the information age, there are open APIs to retrieve information about it.
MIT License
30 stars 11 forks source link

Feature: Button to bookmark this Location #12

Open cassiosousa opened 4 years ago

cassiosousa commented 4 years ago

Create button Bookmark a location

Create action button to bookmark location.

Where go we save that data?

Well, I think should be to save this data on device because we don't have a service like firebase or anything looked. Might we to save with CoreData or anything else like SqlLite?

I wanted help to decide how to implements this Issue.

Thank you.

henrique-morbin-ifood commented 4 years ago

It depends on the nature of the data you want to save.

Is it sensitive? Is it huge? Is it structured? Has it to be restored among reinstallations?

henrique-morbin-ifood commented 4 years ago

Services like Firebase, Parse, iCloud or even a backend, could be used if you are heading to have a more complex platform, with login, multi-channel access (mobile and web).

For structured local persistence, you could go with Realm, CoreData, or even a pure Sqlite (but if you go with Sqlite, I strongly recommend the usage of some wrapper).

For sensitive data, the best choice is going with Keychain.

For non-sensitive and simple structures data, go with UserPreferences or Files in Documents.

cassiosousa commented 4 years ago

Henrique, Great explanation.

I think that to save the data into iCloud is a great idea in this case, besides isn't adding more complexity.

However, I think that to save the locations in keychain is great idea as well, maybe for anybody here might to consider those data are sensitive. The users also could want sync with Icloud.

Now, Let's go to code.

Are you suggest some wrapper to keychain like SwiftKeychainWrapper or keychain-swift?

henrique-morbin-ifood commented 4 years ago

Take a look at that: https://github.com/kishikawakatsumi/KeychainAccess There are more stars.

henrique-morbin-ifood commented 4 years ago

IMHO, a bookmark isn't a kind of sensitive data.

I think you can go with a simple approach to start and let to decide later if more privacy is necessary. Remember, even with the UserPreference approach, the data is secure as long as the cellphone is with the user. If he gets stolen, the bookmark from this POC is the last worry he will have.

cassiosousa commented 4 years ago

Henrique,

I started to work at the view of bookmarkLocation. Those corners are giving work :), but it will be rewarding.

image image
henrique-morbin-ifood commented 4 years ago

Henrique,

I started to work at the view of bookmarkLocation. Those corners are giving work :), but it will be rewarding.

I didn't get it.

cassiosousa commented 4 years ago

Henrique, I started to work at the view of bookmarkLocation. Those corners are giving work :), but it will be rewarding.

I didn't get it.

I'm sorry, 🤦🏻‍♂️ Explanation: