I am currently writing a mobile application that uses a TabBarController to show different views of the same data (map and list). Since my data is short-lived and needs to be updated every 2-10 minutes anyway I do not see any advantage in using CoreData and storing the data longterm.
Common sources on the internet suggest using CoreData (which i dont want to) or using the Singleton design-pattern. My first choice would also have been a Singleton, but apparently the Singleton is regarded as an anti-pattern by a lot of iOS-developers.
What would be an appropriate method to handle this shared data between the two tabs of the TabBarController. As I am new to iOS development I am not entirely sure what the "iOS"-way of solving this problem would be. The data should always be the same in both tabs. A fetch should only be triggered once every few minutes or on reopening the app regardless of what tab the user is currently in.
Infos about my project:
- I am using Alamofire and PromiseKit on iOS and Javascript with
Express for the backend (probably not relevant). - The afore mentioned data is basically the only data within the app, apart from settings and a user profile.
- Subsequent ViewControllers (accessible from within the map and the list) would show and modify single entries of the data.
Aucun commentaire:
Enregistrer un commentaire