提问人:Arnav Motwani 提问时间:5/3/2021 更新时间:5/3/2021 访问量:1848
使用 AppStorage 在 SwiftUI 中持久存储字符串数组
Storing arrays of string persistently in SwiftUI using AppStorage
问:
我正在尝试使用AppStorage属性包装器将字符串数组存储在用户默认值中,如下所示:
@AppStorage("History") var history: [String] = ["End of history"]
但是我收到错误No exact matches in call to initializer
这是 AppStorage 的限制,因为如果我没记错的话,UserDefaults 可以存储数组吗?我可以使用的解决方法是什么?
答: 暂无答案
评论