What is the equivalence of cookies in iOS development

Viewed 93

I am a web developer trying to learn iOS development for fun, especially SwiftUI.

I am building an application that has authentication and I was wondering how users can auto login in the beginning of the app launch. In web development, you can store userID in Cookies and was wondering what is the best practice in SwiftUI.

1 Answers

@AppStorage

SwiftUI has a dedicated property wrapper for reading values from UserDefaults, which will automatically reinvoke your view’s body property when the value changes. That is, this wrapper effectively watches a key in UserDefaults, and will refresh your UI if that key changes

You can read more Here , BTW you can use keychain if that data is sensitive

Related