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.
3 thoughts on “EL Mustache – iOS 8 Photo Extension in Swift”
Kevin Read says:
What a great article. Many thanks.
Can I have your permission (with credit to you of course) to modify the extension, adding a few extra moustache types and colours.
I’d like to publish it in conjunction with the Movember Charity campaign i’m associated with. Movember is a charity that is committed to changing the face of men’s health.
We’d encourage our fund raisers to post every photo in November with a moustache 🙂 A bit of fun.
Hey Kevin, I am happy that you like it! I will contact you directly.