Mercurial > public > lazybear
comparison LazyBear/ContentView.swift @ 457:c6913f0ce46e
Minor UI Updates
author | Dennis Concepción Martín <dennisconcepcionmartin@gmail.com> |
---|---|
date | Mon, 28 Jun 2021 14:03:50 +0200 |
parents | 37c13ebda381 |
children | 783b567800d9 |
comparison
equal
deleted
inserted
replaced
456:d576b2b59014 | 457:c6913f0ce46e |
---|---|
46 1) Create default watchlist if it doesn't exits | 46 1) Create default watchlist if it doesn't exits |
47 2) Show WelcomeView if is the first time that the app is opened | 47 2) Show WelcomeView if is the first time that the app is opened |
48 3) Prepare haptics | 48 3) Prepare haptics |
49 */ | 49 */ |
50 private func onAppear() { | 50 private func onAppear() { |
51 // Create watchlist | 51 // MARK: - Create Watchlist |
52 if watchlistCompanies.isEmpty { | 52 // if watchlistCompanies.isEmpty { |
53 let defaultCompanies: [DefaultCompanyModel] = parseJSON("DefaultCompanies.json") | 53 // let defaultCompanies: [DefaultCompanyModel] = parseJSON("DefaultCompanies.json") |
54 for defaultCompany in defaultCompanies { | 54 // for defaultCompany in defaultCompanies { |
55 let watchlistCompany = WatchlistCompany(context: moc) | 55 // let watchlistCompany = WatchlistCompany(context: moc) |
56 watchlistCompany.name = defaultCompany.name | 56 // watchlistCompany.name = defaultCompany.name |
57 watchlistCompany.symbol = defaultCompany.symbol | 57 // watchlistCompany.symbol = defaultCompany.symbol |
58 watchlistCompany.watchlistName = "Default watchlist" | 58 // watchlistCompany.watchlistName = "Default watchlist" |
59 } | 59 // } |
60 | 60 // |
61 do { | 61 // do { |
62 try moc.save() | 62 // try moc.save() |
63 print("Default watchlist created") | 63 // print("Default watchlist created") |
64 } catch { | 64 // } catch { |
65 print(error.localizedDescription) | 65 // print(error.localizedDescription) |
66 } | 66 // } |
67 } | 67 // } |
68 | 68 |
69 // Show WelcomeView if is the first time that the app is opened | 69 // MARK: - Show WelcomeView if is the first time that the app is opened |
70 // let defaults = UserDefaults.standard | 70 // let defaults = UserDefaults.standard |
71 // | 71 // |
72 // if let isAppAlreadyLaunchedOnce = defaults.string(forKey: "IsAppAlreadyLaunchedOnce") { | 72 // if let isAppAlreadyLaunchedOnce = defaults.string(forKey: "IsAppAlreadyLaunchedOnce") { |
73 // print("App already launched : \(isAppAlreadyLaunchedOnce)") | 73 // print("App already launched : \(isAppAlreadyLaunchedOnce)") |
74 // self.showWelcome = true | 74 // self.showWelcome = true |
75 // } | 75 // } |
76 | 76 |
77 // Prepare haptics | 77 // MARK: - Prepare Haptics |
78 // hapticsManager.prepareHaptics() | 78 // hapticsManager.prepareHaptics() |
79 } | 79 } |
80 } | 80 } |
81 extension ContentView { | 81 extension ContentView { |
82 enum Tab: Hashable { | 82 enum Tab: Hashable { |