Skip to content

Commit

Permalink
Merge pull request #730 from adevinta/729-fix-snapshots-on-main
Browse files Browse the repository at this point in the history
[Switch#729] Added disabled modifier back to switch for testing.
  • Loading branch information
michael-zimmermann authored Jan 5, 2024
2 parents fde6743 + 34d271c commit 7c10d5e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions core/Sources/Components/Switch/View/SwiftUI/SwitchView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public struct SwitchView: View {
.isEnabledChanged { isEnabled in
self.viewModel.set(isEnabled: isEnabled)
}
.disabled(!self.viewModel.isEnabled)
}

// MARK: - Subview Maker
Expand Down Expand Up @@ -193,6 +194,14 @@ public struct SwitchView: View {

// MARK: - Modifier

/// Set disabled
/// - Parameters:
/// - isDisabled: true = disabled, false = enabled
public func disabled(_ isDisabled: Bool) -> Self {
self.viewModel.set(isEnabled: !isDisabled)
return self
}

/// Set the images on switch.
/// - Parameters:
/// - images: The optional images of the switch.
Expand Down

0 comments on commit 7c10d5e

Please sign in to comment.