SwiftUI: What is @AppStorage property wrapper

前端 未结 5 2016
攒了一身酷
攒了一身酷 2020-12-19 03:34

I used to save important App data like login credentials into UserDefaults using the following statement:

UserDefaults.standard.set("sample@email.com&quo         


        
5条回答
  •  余生分开走
    2020-12-19 04:10

    Disclaimer: iOS 14 Beta 2

    In addition to the other useful answers, the types you can use in @AppStorage are (currently) limited to: Bool, Int, Double, String, URL, Data

    Attempting to use other types (such as Array) results in the error: "No exact matches in call to initializer"

提交回复
热议问题