EL Mustache is an example iOS 8 Photo Editing Extension that adds mustaches to your face. Written completely in Swift.
During EL Passion Hackathon that took place on 18th and 19th September, we developed very simple app. The idea was to create application designed for iOS 8, that takes advantages from it’s new features. Moreover, we decided that the project have to be written completely in Swift. That way, the SwiftMustaches project was born. We changed name later to be more user-friendly.
The app uses new Photos framework, introduced with iOS 8 to provide very smart way for photos modification. All changes made by app are saved in
PHAsset‘s adjustment data, represented by
PHAdjustmentData object. It allows to revert photo to its original state easily.
In order to make our project more iOS 8 flavoured, we created Photo Editing Extension that allows to “mustachify” photo straight from Photos app. Along with that, there comes a requirement to use embedded framework, for the source code that needs to be shared between the app and the extension.
The app uses Core Image Face Detection feature, to detect faces on selected photo. Then, it draws mustache on each detected face. Each mustache is drawn on position and angle provided by
CIFaceFeature objects returned from
CIDetector. The positions are archived and stored inside
PHAsset‘s adjustment data.
You can see EL Mustache in action on screens attached below:
EL Mustache source code can be found on GitHub here.