Enumeration¶
Edge¶
An enumeration to indicate one edge of a rectangle.¶
Declaration¶
@frozen enum Edge : Int8, CaseIterable
Overview¶
Edge is most frequently used to specify padding with padding(_:), but it can also be returned from instance methods. For example:
struct ExampleView: View {
var body: some View {
VStack {
Text("Example view where Edge is returned as a value")
.accessibilityScrollAction { edge in
switch edge {
case Edge.top:
print("Swiped down from top edge")
case Edge.leading:
print("Swiped left from leading edge")
case Edge.trailing:
print("Swiped right from trailing edge")
case Edge.bottom:
print("Swiped up from bottom edge")
}
}
}
}
}

Note that for illustrative purposes, the enum values were expanded in this example. It would also be valid to use the shorthand, just specifying the values: .top, .leading, .trailing, and .bottom.
Availability¶
iOS 13.0+
macOS 10.15+
tvOS 13.0+
watchOS 6.0+
Topics¶
Case¶
bottom The rectangle's bottom edge.
leading The rectangle's leading edge.
top The rectangle's top edge.
trailing The rectangle's trailing edge.
Type Property¶
allCases A collection of all values of this type.
Structure¶
Set An efficient set of Edges.
Instance Property¶
rawValue The corresponding value of the raw type.
Initializer¶
init(rawValue:) Creates a new instance with the specified raw value.
Type Alias¶
AllCases A type that can represent a collection of all values of this type.
RawValue The raw type that can be used to represent all values of the conforming type.