Files
letro-ios/ElementX/Sources/Other/SwiftUI/Views/ElementToggleStyle.swift
2022-07-06 16:01:50 +01:00

23 lines
671 B
Swift

//
// ElementToggleStyle.swift
// ElementX
//
// Created by Ismail on 2.06.2022.
// Copyright © 2022 Element. All rights reserved.
//
import SwiftUI
/// A toggle style that uses a button, with a checked/unchecked image like a checkbox.
struct ElementToggleStyle: ToggleStyle {
func makeBody(configuration: Configuration) -> some View {
Button { configuration.isOn.toggle() } label: {
Image(systemName: configuration.isOn ? "checkmark.square.fill" : "square")
.font(.title3.weight(.regular))
.imageScale(.large)
.foregroundColor(.element.accent)
}
.buttonStyle(.plain)
}
}