This file contains hidden or 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
| protocol Randomizable { | |
| static func randomized() -> Self | |
| } | |
| /// - returns: An array of producer functions that will return a value `T`, using the given `factory`, where each producer invokes | |
| /// `factory` with a different combination of parameters. When used to construct a test matrix, the number of returned producers is enough to | |
| /// verify that the equality implementation of `T` correctly considers each input parameter. | |
| func makeTestCasesForEquality<T, each U: Randomizable & Equatable>(factory: @escaping (repeat each U) -> T) -> [() -> T] { | |
| /// - returns: two different random values of the given `type` |
This file contains hidden or 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
| #!/bin/bash | |
| set -e | |
| # ANSI color codes | |
| GREEN="\033[0;32m" | |
| RED="\033[0;31m" | |
| BLUE="\033[0;34m" | |
| GREY="\033[0;90m" | |
| YELLOW="\033[0;33m" | |
| MAGENTA="\033[0;35m" |
This file contains hidden or 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
| #!/bin/bash | |
| set -e | |
| # ANSI color codes | |
| GREEN="\033[0;32m" | |
| RED="\033[0;31m" | |
| BLUE="\033[0;34m" | |
| GREY="\033[0;90m" | |
| YELLOW="\033[0;33m" | |
| MAGENTA="\033[0;35m" |
This file contains hidden or 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 hidden or 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 hidden or 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 | |