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
extension Collection { | |
func parallelMap<T>( | |
parallelism requestedParallelism: Int? = nil, | |
_ transform: @escaping (Element) async throws -> T | |
) async throws -> [T] { | |
let defaultParallelism = 2 | |
let parallelism = requestedParallelism ?? defaultParallelism | |
let n = self.count | |
if n == 0 { |
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 | |
// Foundation.CharacterSet should be called "UnicodeScalarSet" | |
// this operates on actual Characters | |
// TODO: Equatable doesn't work right: for instance defining a range vs defining a set with the same values will not be equal | |
indirect enum CharacterSet: Sendable, Hashable { | |
case closedRange(ClosedRange<Character>) | |
case set(Set<Character>) |
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 Combine | |
import SwiftUI | |
import WebKit | |
@Observable final class WebViewContent: NSObject { | |
let id = UUID() | |
var url: URL? | |
var title: String? |
OlderNewer