Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Examples/Sources/ControlsExample/ControlsApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ struct ControlsApp: App {
#if !canImport(UIKitBackend)
VStack {
Text("Toggle button")
Toggle("Toggle me!", active: $exampleButtonState)
Toggle("Toggle me!", isOn: $exampleButtonState)
.toggleStyle(.button)
Text("Currently enabled: \(exampleButtonState)")
}
Expand All @@ -42,15 +42,15 @@ struct ControlsApp: App {

VStack {
Text("Toggle switch")
Toggle("Toggle me:", active: $exampleSwitchState)
Toggle("Toggle me:", isOn: $exampleSwitchState)
.toggleStyle(.switch)
Text("Currently enabled: \(exampleSwitchState)")
}

#if !canImport(UIKitBackend)
VStack {
Text("Checkbox")
Toggle("Toggle me:", active: $exampleCheckboxState)
Toggle("Toggle me:", isOn: $exampleCheckboxState)
.toggleStyle(.checkbox)
Text("Currently enabled: \(exampleCheckboxState)")
}
Expand Down Expand Up @@ -79,7 +79,7 @@ struct ControlsApp: App {
}
}.padding().disabled(!enabled)

Toggle(enabled ? "Disable all" : "Enable all", active: $enabled)
Toggle(enabled ? "Disable all" : "Enable all", isOn: $enabled)
.padding()
}
}.defaultSize(width: 400, height: 600)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ struct GreetingGeneratorApp: App {
}
}

Toggle("Selectable Greeting", active: $isGreetingSelectable)
Toggle("Selectable Greeting", isOn: $isGreetingSelectable)
if let latest = greetings.last {
LatestGreetingDisplay()
.environment(\.latestGreeting, latest)
Expand Down
2 changes: 1 addition & 1 deletion Sources/SwiftCrossUI/Views/Checkbox.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ struct Checkbox: ElementaryView, View {
private var active: Binding<Bool>

/// Creates a checkbox.
public init(active: Binding<Bool>) {
public init(isOn active: Binding<Bool>) {
self.active = active
}

Expand Down
8 changes: 4 additions & 4 deletions Sources/SwiftCrossUI/Views/Toggle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public struct Toggle: View {
var active: Binding<Bool>

/// Creates a toggle that displays a custom label.
public init(_ label: String, active: Binding<Bool>) {
public init(_ label: String, isOn active: Binding<Bool>) {
self.label = label
self.active = active
}
Expand All @@ -24,15 +24,15 @@ public struct Toggle: View {
Spacer()
}

ToggleSwitch(active: active)
ToggleSwitch(isOn: active)
}
case .button:
ToggleButton(label, active: active)
ToggleButton(label, isOn: active)
case .checkbox:
HStack {
Text(label)

Checkbox(active: active)
Checkbox(isOn: active)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/SwiftCrossUI/Views/ToggleButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ struct ToggleButton: ElementaryView, View {
private var active: Binding<Bool>

/// Creates a toggle button that displays a custom label.
public init(_ label: String, active: Binding<Bool>) {
public init(_ label: String, isOn active: Binding<Bool>) {
self.label = label
self.active = active
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/SwiftCrossUI/Views/ToggleSwitch.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ struct ToggleSwitch: ElementaryView, View {
private var active: Binding<Bool>

/// Creates a switch.
public init(active: Binding<Bool>) {
public init(isOn active: Binding<Bool>) {
self.active = active
}

Expand Down
Loading