66 lines
1.2 KiB
Swift
66 lines
1.2 KiB
Swift
//
|
|
// Set.swift
|
|
// MacBackend
|
|
//
|
|
// Created by david-swift on 11.10.2024.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
extension Set where Element == Edge {
|
|
|
|
/// All edges.
|
|
public static var all: Self {
|
|
vertical.union(horizontal)
|
|
}
|
|
|
|
/// The vertical edges.
|
|
public static var vertical: Self {
|
|
top.union(bottom)
|
|
}
|
|
|
|
/// The horizontal edges.
|
|
public static var horizontal: Self {
|
|
leading.union(trailing)
|
|
}
|
|
|
|
/// The top edge.
|
|
public static var top: Self {
|
|
[.top]
|
|
}
|
|
|
|
/// The bottom edge.
|
|
public static var bottom: Self {
|
|
[.bottom]
|
|
}
|
|
|
|
/// The leading edge.
|
|
public static var leading: Self {
|
|
[.leading]
|
|
}
|
|
|
|
/// The trailing edge.
|
|
public static var trailing: Self {
|
|
[.trailing]
|
|
}
|
|
|
|
/// The SwiftUI edge.
|
|
var swiftUI: SwiftUI.Edge.Set {
|
|
var edges: SwiftUI.Edge.Set = []
|
|
for edge in self {
|
|
switch edge {
|
|
case .top:
|
|
edges.insert(.top)
|
|
case .bottom:
|
|
edges.insert(.bottom)
|
|
case .leading:
|
|
edges.insert(.leading)
|
|
case .trailing:
|
|
edges.insert(.trailing)
|
|
}
|
|
}
|
|
return edges
|
|
}
|
|
|
|
}
|