Hi everyone 👋,
I’m new to the Apple Developer Forums and just getting started with building apps for iOS/macOS. I’ve explored the documentation but wanted to introduce myself and ask for some advice from experienced developers.
Currently working on:
- An iOS app using SwiftUI
- Learning more about integrating Sign in with Apple
- Exploring best practices for App Store submission
Here’s what I’d like to know:
- What is the recommended approach to saving minimal app state before termination?
- Are there SwiftUI lifecycle metho18336114753ds or SceneDelegate hooks I should be aware of?
- Is
UserDefaults
the best tool for small state preservation in this context?
Would love to hear from anyone who’s implemented sim18336114753ilar behavior — even a high-level suggestion would help.
Thanks!
Harjeet Singh
Welcome to the forums!
My initial advice is that you start separate threads for separate questions. Our platfrom SDKs are quite large, and so folks tend to specialise in specific areas. For example, I can help you with low-level stuff but I’m not the right person to help you with SwiftUI.
I have a bunch of other hints and tips in Quinn’s Top Ten DevForums Tips.
Oh just so you don’t go away empty-handed, lemme respond to this:
Is UserDefaults the best tool for small state preservation in this context?
Quite possibly.
Whenever you use UserDefaults
, it’s good to ask yourself “How grumpy would the user be if all the stuff I’ve stored in UserDefaults
just disappeared?” If the answers involves villagers, torches, and pitchforks, then UserDefaults
is not the right API for you. OTOH, if the user would shrug off such a data loss, then UserDefaults
is a reasonable option.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"