How to be more effective when working with certificates and assets during iOS development
In the last few years our team of iOS developers tried countless tools and libraries. Some of them weren't useful at all and we never used them again. Some were useful only when solving specific problems. Only a few of them were so essential that we started to use them on all our projects from their very beginning.
In this category of essential tools definitely belongs Fastlane Match and R.swift. The first one helps you with the always unending battle with certificates. The second one radically improves your effectiveness when working with assets like images, files, localizations etc.
I think every small team knows this. App is developed, everything is tested and the app goes on the App Store. People start to use it and they find a critical bug. Unfortunately, your colleague, who developed the app, went on a holiday and that's why you're tasked with fixing this bug.
You open up the project but you find out you're missing signing certificates. Your colleague is the one who created them and he's the only one who has them but he didn't bring his notebook with him.
That's why you have to erase the certificates and create new ones and after your colleague returns from his vacation you need to remember to give them to him so he's not forced to do the same as you a week later.
Fastlane Match is built exactly for these kinds of situations. It's a tool for easy management and sharing of certificates and provisioning profiles. It's able to connect to your Apple Developer account, create signing certificates and provisioning profiles for a given app and then install them onto your local machine. It also uploads them to a private repository where they are accessible to the rest of your team.
Starting with Fastlane Match is pretty simple. First you need to install it using this command:
sudo gem install fastlane
Then go to the root directory of your project and write this command to initialize Fastlane Match:
fastlane match init
You'll be prompted to enter a URL of your private repository where the created certificates will be saved. After that a new file called Matchfile will be created inside your project. The newly created file doesn't have much inside it but after a simple configuration it can look something like this:
After simple configuration all that's left to do is write this command:
fastlane match development
Fastlane Match will generate new certificates and provisioning profiles. If the certificates already exist it will download them from your private repository and install them onto your local machine. Besides development you can also use appstore, enterprise or adhoc.
R.swift is a script which runs every time you build your application. It searches the whole project for resources like images, fonts, localizations or storyboards and then creates references to these resources in a single file named R.generated.swift.
As a result, instead of loading an image from asset catalogue using its name it can look something like this:
If you decide to delete an image from your project or you just want to rename it, you won't be able to build your project and the compiler will tell you what went wrong.
Fully supported autocomplete.
No more casting! When dequeuing UITableViewCell it already has the correct type.
Another situation in which this library is useful are localizations. They can easily grow into hundreds or thousands of keys and it gets harder and harder not to lose your mind when working with them. Luckily, using R.swift it can go from this:
The control question - what are cookies? Choose the correct answer.
Cookies are not sweets, but text files
We want to have an overview of how it goes on our website. But you have the power to affect how much we know about your visit.
As application and web developers, we are very interested in analytical data, so we will be grateful for your absolute consent.
Select your preferred cookie permissions, the basic ones are necessary for operation, others we can use only with your consent.
Your personal data will be processed and information from your device (cookies, personality identifiers and other data collected) may be stored.