Skip to content

Instantly share code, notes, and snippets.

View tomasharkema's full-sized avatar

Tomas Harkema tomasharkema

View GitHub Profile
let activity = NSUserActivity(activityType: shipment.key)
UIApplication.shared.requestSceneSessionActivation(nil, userActivity: activity, options: nil, errorHandler: {})
@tomasharkema
tomasharkema / whenAll.swift
Created June 10, 2021 13:20
Await all in Swift 5.5
func whenAll<T>(tasks: [Task.Handle<T, Error>]) async throws -> [T] {
try await withThrowingTaskGroup(of: [T].self, body: { group in
for task in tasks {
group.async {
[try await task.get()]
}
}
return try await group.reduce([], +)
})