Add round style class #74
Some checks are pending
Deploy Docs / publish (push) Waiting to run
SwiftLint / SwiftLint (push) Waiting to run

This commit is contained in:
david-swift 2026-02-02 21:32:10 +01:00
parent 6b76a4c8f4
commit c976c29cd0
2 changed files with 23 additions and 16 deletions

View File

@ -108,6 +108,13 @@ extension AnyView {
style("circular", active: active) style("circular", active: active)
} }
/// Make a button or similar widget use round appearance.
/// - Parameter active: Whether the style is currently applied.
/// - Returns: A view.
public func round(_ active: Bool = true) -> AnyView {
style("round", active: active)
}
/// Make a button or similar widget appear as a pill. /// Make a button or similar widget appear as a pill.
/// - Parameter active: Whether the style is currently applied. /// - Parameter active: Whether the style is currently applied.
/// - Returns: A view. /// - Returns: A view.
@ -367,4 +374,20 @@ extension AnyView {
} }
} }
/// Whether the view has a width higher or equal to its natural width.
/// - Parameters:
/// - matches: Whether the content view matches the breakpoint.
/// - padding: Increase the natural width by a certain padding.
public func naturalWidth(matches: Binding<Bool>, padding: Int = 0) -> AnyView {
BreakpointBin(condition: .naturalWidth(padding: padding), matches: matches) { self }
}
/// Whether the view has a height higher or equal to its natural height.
/// - Parameters:
/// - matches: Whether the content view matches the breakpoint.
/// - padding: Increase the natural height by a certain padding.
public func naturalHeight(matches: Binding<Bool>, padding: Int = 0) -> AnyView {
BreakpointBin(condition: .naturalHeight(padding: padding), matches: matches) { self }
}
} }

View File

@ -382,22 +382,6 @@ extension AnyView {
BreakpointBin(condition: .minHeight(minHeight), matches: matches) { self } BreakpointBin(condition: .minHeight(minHeight), matches: matches) { self }
} }
/// Whether the view has a width higher or equal to its natural width.
/// - Parameters:
/// - matches: Whether the content view matches the breakpoint.
/// - padding: Increase the natural width by a certain padding.
public func naturalWidth(matches: Binding<Bool>, padding: Int = 0) -> AnyView {
BreakpointBin(condition: .naturalWidth(padding: padding), matches: matches) { self }
}
/// Whether the view has a height higher or equal to its natural height.
/// - Parameters:
/// - matches: Whether the content view matches the breakpoint.
/// - padding: Increase the natural height by a certain padding.
public func naturalHeight(matches: Binding<Bool>, padding: Int = 0) -> AnyView {
BreakpointBin(condition: .naturalHeight(padding: padding), matches: matches) { self }
}
/// Build the UI from scratch once the identifier changes. /// Build the UI from scratch once the identifier changes.
/// - Parameter id: The identifier. /// - Parameter id: The identifier.
public func id(_ id: CustomStringConvertible) -> AnyView { public func id(_ id: CustomStringConvertible) -> AnyView {