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 that can be applied to `Equatable` properties of `ObservableObject` to notify observers of unique changes | |
| @propertyWrapper | |
| struct UniqueChanges<Element: Equatable> { | |
| init(wrappedValue: Element) { | |
| self._wrappedValue = wrappedValue | |
| } | |
| @available(*, unavailable, message: "@UniqueChanges can only be applied to types that conform to `ObservableObject`") | |
| var wrappedValue: Element { |
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
| // Backports the Swift 6 type Mutex<Value> to all Darwin platforms via OSAllocatedUnfairLock. | |
| // Lightweight version of https://github.com/swhitty/swift-mutex | |
| // Feel free to use any part of this gist. | |
| import struct os.OSAllocatedUnfairLock | |
| // Backports the Swift 6.0 Mutex API | |
| @available(iOS, introduced: 16.0, deprecated: 18.0, message: "use Mutex from Synchronization module") | |
| @available(macOS, introduced: 13.0, deprecated: 15.0, message: "use Mutex from Synchronization module") | |
| public struct Mutex<Value: ~Copyable>: @unchecked Sendable, ~Copyable { |
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
| #!/usr/bin/swift | |
| import Foundation | |
| let resultsJSON = CommandLine.arguments.count > 1 ? URL(filePath: CommandLine.arguments[1]) : nil | |
| guard let resultsJSON else { | |
| print("usage: ./junit.swift <test_results.json>") | |
| exit(70) | |
| } |
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
| public extension Task where Failure == Never { | |
| /// Create and immediately start running a new detached task on the @MainActor. | |
| /// | |
| /// If the current actor is @MainActor, the spawned task immediately takes over | |
| /// execution in a synchronous manner, before returning to the calling method at the | |
| /// first suspension point. | |
| /// | |
| /// If the current actor is not @MainActor then behaviour is the similar to using `Task { }` | |
| /// |
OlderNewer