This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct DynamicShapeStyle: ShapeStyle { | |
let light: AnyShapeStyle | |
let dark: AnyShapeStyle | |
init<Light: ShapeStyle, Dark: ShapeStyle>(light: Light, dark: Dark) { | |
self.light = AnyShapeStyle(light) | |
self.dark = AnyShapeStyle(dark) | |
} | |
func resolve(in environment: EnvironmentValues) -> some ShapeStyle { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@propertyWrapper | |
struct Sorted<Value> { | |
var wrappedValue: [Value] { | |
didSet { | |
wrappedValue.sort(by: comparator) | |
} | |
} | |
typealias Comparator = (Value, Value) -> Bool |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
class MiddlewareStack<T, U> { | |
typealias Next = (T) -> U | |
typealias Layer = (T, Next) -> U | |
private var layers = [Layer]() | |
private let center: Next | |
private var stack: Next | |