Building Image Filter macOS app with SwiftUI

Alfian Losari
The Startup
Published in
11 min readMay 14, 2020

--

Image Filter SwiftUI macOS App

SwiftUI enables developers to use unified tools and API for building full native applications across Apple platforms. We can target specific platforms and build the UI component without having expertise for each target specific framework such as UIKit (iOS & tvOS), AppKit (macOS), and WatchKit (watchOS). As a developer, we can build apps much faster with declarative syntax, safer with reactive binding and state management between UI and model. At last, we don't have to do context switching when building across platforms.

What We Will Build

In this tutorial, we will build a native Image Filter macOS App with the following features:

  • Filter image using predefined filters from the GPUImage2 Swift library.
  • Select input image using macOS file panel (NSOpenPanel).
  • Drag & Drop input image using SwiftUI View modifier.
  • Save the filtered image using macOS file panel (NSSavePanel).
  • App state management handling with ObservableObject and EnvironmentObject.
  • Lazy loading of filtering operation for image.
  • Challenge section to convert closures callback to use Binding to update value from child view back to the parent view.

--

--

Alfian Losari
The Startup

Mobile Developer and Lifelong Learner. Currently building super app @ Go-Jek. Xcoding with Alfian at https://alfianlosari.com