Aligned
public struct Aligned : Element
Aligns a content element within itself. The vertical and horizontal alignment may be set independently.
When using alignment mode .fill
, the content is scaled to the width or height of the Aligned
element.
For other modes, the size of the content element is determined by calling measure(in:)
on the content element – even if that size is larger than the wrapping element.
-
The possible vertical alignment values.
See moreDeclaration
Swift
public enum VerticalAlignment
-
The possible horizontal alignment values.
See moreDeclaration
Swift
public enum HorizontalAlignment
-
The content element to be aligned.
Declaration
Swift
public var wrappedElement: Element
-
The vertical alignment.
Declaration
Swift
public var verticalAlignment: VerticalAlignment
-
The horizontal alignment.
Declaration
Swift
public var horizontalAlignment: HorizontalAlignment
-
Initializes an
Aligned
with the given content element and alignments.Declaration
Swift
public init( vertically verticalAlignment: VerticalAlignment = .center, horizontally horizontalAlignment: HorizontalAlignment = .center, wrapping wrappedElement: Element )
Parameters
vertically
The vertical alignment. Defaults to centered.
horizontally
The horizontal alignment. Defaults to centered.
wrapping
The content element to be aligned.
-
Declaration
Swift
public var content: ElementContent { get }
-
Declaration
Swift
public func backingViewDescription(with context: ViewDescriptionContext) -> ViewDescription?