25 lines
537 B
Swift
25 lines
537 B
Swift
import SwiftUI
|
|
|
|
/// A label style that puts the title first and icon second.
|
|
public struct ReverseLabelStyle: LabelStyle {
|
|
let spacing: CGFloat
|
|
|
|
public init(spacing: CGFloat = 3) {
|
|
self.spacing = spacing
|
|
}
|
|
|
|
public func makeBody(configuration: Configuration) -> some View {
|
|
HStack(spacing: spacing) {
|
|
configuration.title
|
|
configuration.icon
|
|
}
|
|
}
|
|
}
|
|
|
|
extension LabelStyle where Self == ReverseLabelStyle {
|
|
|
|
public static func reverse(spacing: CGFloat = 3) -> Self {
|
|
.init(spacing: spacing)
|
|
}
|
|
}
|