We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@ObservedObject
final class MyViewModel: ObservableObject { @Published var isOn = false func toggle() { isOn.toggle() } }
🔼위 모델의 인스턴스를 @ObservedObject로 참조
struct ContentView: View { @ObservedObject var viewModel1 = MyViewModel() var body: some View { VStack { Button(viewModel1.isOn ? "on" : "off") { viewModel1.toggle() } } } }
참고: https://ios-development.tistory.com/1160 https://developer.apple.com/documentation/swiftui/observedobject
The text was updated successfully, but these errors were encountered:
No branches or pull requests
ObservedObject?
@ObservedObject 사용 방법
@ObservedObject
로 선언하여 참조ex) @ObservedObject 사용하여 MVVM 패턴 만들기
🔼위 모델의 인스턴스를
@ObservedObject
로 참조참고: https://ios-development.tistory.com/1160
https://developer.apple.com/documentation/swiftui/observedobject
The text was updated successfully, but these errors were encountered: