Tuesday, July 12, 2022

[FIXED] How to display a message on startup about new feature only to pervious users

Issue

I am adding new features and want to create a message (like a UIAlertController) at app startup that explains the new features.

Is there anyway to do this to users that have already downloaded the app? New users that download the app don't need to see the new features message because to them every feature is new since they've never used the app before. Or perhaps I would have a message but the content would be different.

Thanks!


Solution

The easiest way is to save the current version in UserDefaults:

var defaults = UserDefaults.standard
defaults.set(2.2, forKey: "lastVersion")

Then on your Initial View Controller check to see if they have the latest version:

override func viewDidLoad() {
     super.viewDidLoad()
     if let lastVersion = NSUserDefaults.standard(forKey: "lastVersion") {
        print(lastVersion)
     }
}

Then it's up to you on how you wish to present the list of new features.



Answered By - Martin Muldoon
Answer Checked By - Mary Flores (PHPFixing Volunteer)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.