Skip to content

Instantly share code, notes, and snippets.

@laevandus
Created August 15, 2021 13:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save laevandus/6e403cd46627e271a76ce4237b03a4ad to your computer and use it in GitHub Desktop.
Save laevandus/6e403cd46627e271a76ce4237b03a4ad to your computer and use it in GitHub Desktop.
public func loadData<T>(forIdentifier identifier: Identifier, dataTransformer: @escaping (Data) -> T?) async -> T? {
return await withCheckedContinuation({ continuation in
self.loadData(forIdentifier: identifier, dataTransformer: dataTransformer) { object in
continuation.resume(returning: object)
}
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment