Skip to content

Commit

Permalink
chore: better manage of state object for checkbox VM
Browse files Browse the repository at this point in the history
Signed-off-by: Pierre-Yves Lapersonne <[email protected]>
  • Loading branch information
pylapp committed Feb 4, 2025
1 parent c642833 commit 22c04fd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ final class CheckboxConfigurationModel: ComponentConfiguration {

struct CheckboxConfiguration: View {

@StateObject var model: CheckboxConfigurationModel
@ObservedObject var model: CheckboxConfigurationModel

@Environment(\.theme) private var theme
@Environment(\.colorScheme) private var colorScheme
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ import SwiftUI

struct CheckboxPage: View {

private let configuration = CheckboxConfigurationModel()
@StateObject private var configuration: CheckboxConfigurationModel

init() {
_configuration = StateObject(wrappedValue: CheckboxConfigurationModel())
}

var body: some View {
ComponentConfigurationView(
Expand Down Expand Up @@ -65,7 +69,7 @@ struct CheckboxIllustration: View {

private struct CheckboxDemo: View {

@StateObject var model: CheckboxConfigurationModel
@ObservedObject var model: CheckboxConfigurationModel
@Environment(\.theme) private var theme

var body: some View {
Expand Down

0 comments on commit 22c04fd

Please sign in to comment.