Skip to content

Instantly share code, notes, and snippets.

Last active August 20, 2022 03:02
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
@MainActor final class ViewModel: ObservableObject {
func prepare() {
Task {
do {
async let wallpaperData = service.fetchImageData(id: "blue_wallpaper")
async let overlayData = service.fetchImageData(id: "gradient_overlay")
self.backgroundImage = try await ImageProcessor.merge(background: wallpaperData, overlay: overlayData)
} catch {
// TODO: present/handle error
struct ImageProcessor {
static func merge(background: Data, overlay: Data) throws -> UIImage {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment