Common UI+View
extension View
Conditionally adds a shadow to the view.
Important
This is a Public Preview API. It may be changed or removed at any time.
Declaration
Swift
@ViewBuilder
public func conditionalShadow(_ shouldShow: Bool) -> some View
Parameters
shouldShow
|
A Boolean value that determines whether the shadow should be shown. |
Return Value
A view that conditionally applies a shadow.
Adds a corner radius to specific corners of the view.
Important
This is a Public Preview API. It may be changed or removed at any time.
Declaration
Swift
public func cornerRadius(_ radius: CGFloat, corners: UIRectCorner) -> some View
Parameters
radius
|
The radius of the corner. |
corners
|
The corners to which the radius is applied. |
Return Value
A view that has the specified corner radius applied to the specified corners.
A view modifier that conditionally hides the view.
Important
This is a Public Preview API. It may be changed or removed at any time.
Declaration
Swift
@ViewBuilder
public func hidden(_ shouldHide: Bool) -> some View
Parameters
shouldHide
|
A Boolean value that determines whether the view should be hidden. |
Return Value
A view that is conditionally hidden.
Applies a custom style to a button with an image and text.
Important
This is a Public Preview API. It may be changed or removed at any time.
Declaration
Swift
public func imageTextButtonStyle(_ color: Color, fontColor: Color) -> some View
Parameters
color
|
The background color of the button. |
fontColor
|
The color of the text and image. |
Return Value
A view with applied style.
Adds an overlay to the view.
Important
This is a Public Preview API. It may be changed or removed at any time.
Declaration
Swift
@ViewBuilder
public func overlay(show: Bool, height: CGFloat, overlayOpacity: Double) -> some View
Parameters
show
|
A Boolean value that determines whether the overlay is shown. |
height
|
The height of the overlay. |
overlayOpacity
|
The opacity of the overlay. |
Return Value
A view that conditionally applies an overlay.
Reads the size of the view and triggers the onChange
closure with the new size.
Important
This is a Public Preview API. It may be changed or removed at any time.
Declaration
Swift
public func readSize(onChange: @escaping (CGSize) -> ()) -> some View
Parameters
onChange
|
A closure that gets called with the new size of the view. |
Return Value
A view that reads its size and triggers the onChange
closure.
Adds a modifier to round the top edges of the view.
Important
This is a Public Preview API. It may be changed or removed at any time.
Declaration
Swift
public func topEdgesRounded() -> some View
Return Value
A view with the top edges rounded.
Conditionally wraps the view inside a horizontal ScrollView.
Important
This is a Public Preview API. It may be changed or removed at any time.
Declaration
Swift
@ViewBuilder
public func wrapInScroll(_ shouldWrap: Bool) -> some View
Parameters
shouldWrap
|
A Boolean value that determines whether to wrap the view in a ScrollView. |
Return Value
A view that is conditionally wrapped in a horizontal ScrollView.