Skip to content

Instantly share code, notes, and snippets.

@laevandus
Created July 23, 2022 02:37
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/ff739d81acad008acf6967ada9192c23 to your computer and use it in GitHub Desktop.
Save laevandus/ff739d81acad008acf6967ada9192c23 to your computer and use it in GitHub Desktop.
@MainActor
final class ViewModel: ObservableObject {
let imageProcessor = ImageProcessor()
@Published var currentImage: UIImage?
func applyEffectsToImage() {
print(#function, Thread.isMainThread, Thread.current)
Task {
print(#function, Thread.isMainThread, Thread.current)
let imageData = Data()
currentImage = await imageProcessor.process(imageData)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment