Filtr | iOS Photo Filters and Effects Application

Introduction

Please carefully read this guide in order to fully configure this template, and remember to test it on a Real Device – the iOS Simulator may fail sometimes.

An internet connection is required.

Quick Start

You may just run this app on your own device via Xcode and play with it, it will work.
Anyway you need to customize this app into your own version, so just keep reading this guide.

General

Xcode

This template has a native Apple Swift code, so you can edit it only with Xcode running on a Mac computer. If you don’t have it, download it for free on the Mac App Store.

PLEASE NOTE that you’ll need the latest official version of XcodeNO BETAS, because Betas are always buggy and never work properly.

App Name and Bundle ID

You must change the Display Name and Bundle Identifier into the new ones in the General tab in Xcode: 

Archive App for App Store Publishing

Once your app is ready to be submitted to the App Store for review, you need to Archive your Xcode project.
Click on Product and select Archive. Xcode will archive your project and automatically open the Organizer window, where you’ll find a button to submit your binary to your App Store Connect account.

Reskin the UI design of the app

This project has a Storyboard file called Main.storyboard and you can find it in the list of file that is shown in left-side panel of the Xcode window.
You can edit all the UI elements of this app from the Storyboard, Colors, Fonts, Buttons, Views positions, etc.

The strings of the Alert Controllers are located in the code, so they can be edited only in the .swift files.

The images are stored into the Assets.xcassets folder.

Configurations

The Configurations.swift file

Open this file in Xcode and keep reading this guide, you’ll have to perform some edits in this file in order to get your template ready to run:

App Name

Replace this string with the new name you want to give to this app:

let APP_NAME = "Filtr"

AdMob Ads

Replace the string of the variable below with your own Interstitial Unit ID – you have to create such Unit ID on apps.admob.com, just follow the instructions on the AdMob’s website in case you don’t know how to generate a Unit ID:

let ADMOB_INTERSTITIAL_UNIT_ID = "ca-app-pub-3940256099942544/1033173712"

You also have to replace the string into Info.plist with your own App ID:

You can get both App ID and Unit ID strings from your AdMob Unit page, after creating it:

Sometimes Apple reviewers reject apps because of Ads, the reason why is not clear yet, but a new submission on the App Store will fix the problem and get your app approved – just in case you’ll get a rejection because of IDFA issue.
Anyway, after clicking the Submit For Review button on the App Store Connect page of your application, you’ll get something that looks like the picture below. Mark the options shown below and everything should go smoothly on the next review you’ll get of your app:

Custom Colors

You can edit the HEX values of the following variables as you wish, change the numbers before # symbol. The main color of the app and some UI will be affected by your change:

let MAIN_COLOR = hexValue(hex: "#252525")

PLEASE NOTE that NOT all Views in the app will change accordingly to the new RGB values you’ve set in the above variable, you will still need to adjust some colors in some Controllers in the Storyboard.

Custom fonts

This App uses some custom font, which is already stored in the Xcode files list.
In case you want to add a new font, you have to first drag your .ttf or .otf font file into the left-side panel in Xcode and click the Finish button in the popup that will show up:

Then select the Label, Button, TextFiled or textView you want to change font to, click the [T] icon on the right-side Attributes inspector panel and select the font you want in the dropdown list:

App Store Link

You should copy the App ID of your app on the App Store Connect website and replace XXXXXXXXX in the string below to allow users to get your app from social shares:

let APP_STORE_LINK = "http://itunes.apple.com/app/idXXXXXXXXX"

You can grab the App ID of your app in the App Information section:

Arrays of Photo Filters

This app uses a few Apple Core Image filters, which are listed in the following arrays:

let enhanceFilters = [
    "NoFilter-No Filter",
    "CIPhotoEffectInstant-Nereid",
    "CIPhotoEffectProcess-Celestia",
    "CIPhotoEffectTransfer-Hone",
    "CISepiaTone-Siren",
    "CIPhotoEffectChrome-Arener",
    "CIPhotoEffectFade-Seahag",
]

let blackWhiteFilters = [
    "NoFilter-No Filter",
    "CIPhotoEffectTonal-Tirohen",
    "CIPhotoEffectNoir-Lampey",
    "CIMaximumComponent-Donjon",
    "CIMinimumComponent-Cracot",
    "CIDotScreen-Wafeld",
]

let luminanceFilters = [
    "NoFilter-No Filter",
    "CIColorInvert-Falkon",
    "CIColorPosterize-Marlin",
    "CISharpenLuminance-Lumino",
    "CIVignette-Utopya",
    "CIExposureAdjust-Triton",
    "CIExposureAdjust-Mopool",
    "CIGammaAdjust-Shoalb",
    "CIGammaAdjust-Haro",
]

let colorFilters = [
    "NoFilter-No Filter",
    "CIColorMonochrome-Beada",
    "CIColorMonochrome-Arcadin",
    "CIColorMonochrome-Windul",
    "CIColorMonochrome-Nemehia",
    "CIColorMonochrome-Bane",
    "CIColorMonochrome-Bifar",
    "CIFalseColor-Rotard",
    "CIFalseColor-Feeny",
    "CIFalseColor-Flamy",
]

let hueFilters = [
    "NoFilter-No Filter",
    "CIHueAdjust-Avaroce",
    "CIHueAdjust-Dalphyn",
    "CIHueAdjust-Crimson",
    "CIHueAdjust-Lorem",
    "CIHueAdjust-Erham",
]

let specialFilters = [
    "NoFilter-No Filter",
    "CIPixellate-Earagh",
    "CIGaussianBlur-Halberd",
    "CIGlassDistortion-Madan",
    "CICMYKHalftone-Bretos",
    "CICrystallize-Annow",
    "CIEdges-Stinlay",
    "CIEdgeWork-Iculn",
    "CIShadedMaterial-Merhoyd",
    "CILineOverlay-Nula",
    "CIPointillize-Mantal",
]

You can add new photo filter arrays if you want. In this case, I strongly suggest you to first get familiar with Core Image Effects from the Core Image Filter Reference Documentation.

Then, here’s an example of the steps you should perform to add new filters to this app:

1] Create a new array, let’s say you’ll call it as awesomeFilters, insert it below the specialFilters one:

let awesomeFilters = [
    "NoFilter-No Filter", <-- THIS ITEM MUST ALWAYS BE PRESENT AS FIRST ELEMENT!
    "CIColorMonochrome-Name1",
    "CIPhotoEffectProcess-Name2",
    "CIPhotoEffectTransfer-Name3",
]

As you may notice, the items of that array contain a first item that’s always called "NoFilter-No Filter". This item must always be present in the first position of each array – check out the existing arrays to see it.

The other names are made by the original Core Image Filter name and a custom name of your choice, separated by a () symbol, like "CIColorMonochrome-Name1", where CIPhotoEffectInstant is the Core Image filter name, and Name1 is your custom name.
This is also important because the app splits the 2 names in the code in order to work properly. So grab the Core Image Filter names you want to add in your array and set their custom names carefully – check the existing arrays to see how they look like.

2] Enter the FiltersScreen.swift file and scroll down to the setupFilterButtonsScrollView() function.

3] Inside the switch selectedFiltersList statement, add your new case like this:

case 6:
    filtersArray = awesomeFilters
    titleLabel.text = "Awesome" <-- NAME OF YOUR FILTERS SET, SHOWN IN THE APP
    break

IMPORTANT: Make sure to update the existing case 6 into case 7, since that case must always be the last one, because it shows the Filters you’ve saved in your personal Collection:

// • YOUR FILTERS COLLECTION •
case 7: <-- CHANGED 6 INTO 7, SO IT'S ALWAYS THE LAST 'case'
    filtersArray = yourFiltersCollection
    filtersArray.insert(enhanceFilters[0], at: 0)
    titleLabel.text = "Filters Collection"
    break

4] Scroll down until you get to the switch filtersArray[i] statement. You can see that it contains several cases with the full names of the filters, for instance "CIColorMonochrome-Beada".
In case your Core Image Filters need some adjustment by code, do it by settings its properties, like this example:

case "CIColorMonochrome-Name1":
    let color = hexValue(hex: "#12A5B2")
    filter!.setValue(CIColor(color: color), forKey: kCIInputColorKey)
    filter!.setValue(0.5, forKey: kCIInputIntensityKey)
    break

5] So add your switch case in there and set your parameters, accordingly to the Core Image Filter reference guide mentioned before.

6] Add other switch cases like the one above for the other Filters of your awesomeFilters array.

You’re done, run the app and test it out to see if your new Filters work. You should see your new Awesome filters name in the ActionSheet:

Again, please note that the awesomeFilters array is just an example, you can create the one you wish.

Utility Functions

Unless you are familiar with iOS programming, you should leave the code of this section as it is since it includes useful functions to show alerts and perform other things in the app.

 Useful stuff

F.A.Q.

What kind of support is offered?

Free support is offered in case of bugs encountered in the original template, either in the code or the UI design.
In case you have edited the code – and so created bugs because of your editing – I may apply some fee to fix your bugs by a remote connection through AnyDesk, or by you sending me your source code for verification.

Should I use Xcode to edit this template?

Yes, you must always use the latest stable official version of Xcode to edit this application.
Download the latest version on the Mac App Store from your Mac.

I’ve performed all configurations mentioned in this Guide, but something is wrong. What should I do?

• Double-check all your configurations, probably you have missed something.
• Always check the Console log in Xcode if the app crashes.
The Console log helps to debug your app, it’s really important.

How do I remove AdMob ads?

It’s super easy, just open the Find tool on the left-side panel in XCode and search for this line:

showinterstitial

Xcode will show you a list of swift files where such code is located. Click on each row and just comment – or remove – that line of code in each the swift file:

If you want to comment that line of code, do like this:

// showInterstitial()

IMPORTANT: DO NOT COMMENT the line of code in Configurations.swift, comment (or remove) the lines in the other swift files.

Support | Contact