Last active
April 30, 2019 11:57
-
-
Save Shinolr/76f9814954e9026ed247e7fef56adbc2 to your computer and use it in GitHub Desktop.
Revisions
-
Shinolr revised this gist
Apr 30, 2019 . 1 changed file with 0 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,3 @@ protocol AppGuide { func shouldLoadAppGuide() -> Bool } -
Shinolr created this gist
Apr 30, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ import Foundation protocol AppGuide { func shouldLoadAppGuide() -> Bool } extension AppGuide { func shouldLoadAppGuide() -> Bool { guard let versionString = Bundle.main.object(forInfoDictionaryKey: "CFBundleVersion") as? String else { return false } guard let currentVersion = Int(versionString) else { return false } let lastVersion = UserDefaults.standard.integer(forKey: "CFBundleVersion") guard currentVersion > lastVersion else { return false } UserDefaults.standard.set(currentVersion, forKey: "CFBundleVersion") return true } }