Userdefaults의 변화를 자동으로 UI를 변화하게 만들고 싶어요 #26
Unanswered
seongahshin
asked this question in
Q&A
Replies: 1 comment
-
SwiftUI에서는 UserDefault를 핸들링하기 위해 AppStorage라는 프로퍼티래퍼가 있습니다 :) 기본 형식은 아래와 같습니다. AppStorage("userDefaultKeyName") var userDefaultVariable: Bool = false
https://developer.apple.com/documentation/swiftui/appstorage |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
현상
Userdefaults 가 변화면 자동으로 UI까지 변화하게 만들고 싶어요...
원인
Usedefaults 에는 자체적으로 변화를 감지할 수 있는 기능이 존재하지 않습니다.. 그래서 ObservableObject Class 로 감싸서 Published 를 사용해야 하는지.. 아니면 또 다른 좋은 방법이 있는 것인지 모르겠습니다!
Beta Was this translation helpful? Give feedback.
All reactions