Allowing parallel iOS UI tests runs in CI
May 19, 2021, 12:29 AM
If you have your CI machine set up to run multiple jobs in parallel you might have encountered a problem. You cannot run multiple iOS UI tests in the same simulator at the same time. They will fail.
Imagine this scenario. You...
Reading environment variables from iOS and macOS unit tests
Mar 17, 2021, 12:29 AM
In some environments like the CI/CD you might need to read environments variables from your iOS or macOS unit tests.
A typical example might be reading secrets or configuration that is CI/CD specific and you do not want to store it in...
Graying out images in Cocoa
Feb 16, 2021, 11:29 PM
I have been working on a macOS application recently where I encountered an interesting task to grey out flags for countries that are disabled.
I first tried overlaying a semi-transparent gray view (fun fact, you cannot directly...
Using different Git config for personal and work projects
Dec 1, 2020, 11:29 PM
I use the same machines to work on both personal and work projects. I usually have to use a different Git identity for the work projects than for my personal projects.
Previously I had my personal Git identity set globally and then used...
Web scraping with Swift
Nov 17, 2020, 11:29 PM
In a few projects in the past I needed to do web scraping to get some data from websites that did not offer access via an API. I was using C# at the time and scraping web with Html Agility Pack was quite easy.
I now spend most of my time...
Generating boilerplate Swift code with GYB
Oct 7, 2020, 12:29 AM
How many times how you copied and pasted some code in your current codebase because there was no good way to abstract it? Maybe because it was some repeating code required by a framework or mapping of some data transfer structures.
How much time a day do you waste waiting for Xcode builds?
Aug 19, 2020, 12:29 AM
Have you ever wondered how much time a day you spend waiting for Xcode to do your builds?
Working on a project that is almost entirely written in Swift I wonder that every day with a feeling that it is a non-trivial amount of time just...
Using Intel Wi-Fi and Bluetooth on a hackintosh
Jul 29, 2020, 12:29 AM
If you use a hackintosh you have to choose your hardware carefully to make sure it is supported by macOS. You can get Wi-Fi + Bluetooth card used by Apple as I did in my desktop, but sometimes you do not have much choice.
When I turned by...
Converting slow motion video to an URL asset for upload
Jul 22, 2020, 12:29 AM
In the iOS application I currently work on the users can choose a video from the device’s gallery and that video gets uploaded to the backend.
This functionality has always worked fine but recently somebody tried to upload s slow...
A few reason why your MKMapView unexpectedly crashes and how to fix them
Jun 10, 2020, 12:29 AM
In the last few months I have been working more intensively with MapKit, doing more advanced operations like clustering map annotations or animating annotation position changes.
I have encountered a few problem resulting in MKMapView quite...
Dealing with memory limits in iOS app extensions
May 27, 2020, 12:29 AM
In the iOS app I currently work on there is a Notification Service Extension and a Share Extension. Both extensions have been implemented quite some time age and have been working fine.
Recently I got some bug reports that led to...
Animating annotations position change in MKMapView
May 13, 2020, 12:29 AM
Annotations are mainly used to displays static “pins” in MKMapView but sometimes you might need to make them move and animate their position changes so it looks better to the users.
There are a few things you need to do to...
Clustering annotations in MKMapView
May 6, 2020, 12:29 AM
If you need to display many annotations in your MKMapView it is recommended to cluster them for better performance.
This means instead of showing all the visible annotations you group annotations that are close together into...
Using custom annotation views in MKMapView
Apr 29, 2020, 12:29 AM
If you want to display completely custom views as “pins” on the map in your iOS application, you should use annotations. All your data needs to be represented as objects conforming to the MKAnnotation protocol, with title,...
Logging error messages from assert and fatalerror
Apr 15, 2020, 12:29 AM
I often use fatalerror(message:) in my code base to deal with invalid states when the application cannot continue. A typical example can be a method that requires to be called only after the user has logged in:
guard let loggedUser =...
Workaround for Swift scripts crashing after update to Xcode 11.4
Mar 26, 2020, 12:29 AM
If you have already updated to Xcode 11.4 that ships with Swift 5.2 you might have noticed that your Swift scripts all started crashing when accessing anything related to URL.
I use a script to generate a list of libraries used in the app...
Determining which frameworks use UIWebView
Mar 18, 2020, 12:29 AM
Apple has deprecated UIWebView and will not be accepting new apps with UIWebView starting April 2020 and app updates with UIWebView starting December 2020. If your app uses UIWebView you should replace it with WKWebView.
The check for...
Faster way to download and install Xcode
Nov 19, 2019, 11:29 PM
As an iOS developer you need to periodically update your Xcode, on your own machine and on your CI/CD server if you automate your development workflow. There are multiple ways to do this so do not waste your time and use the fastest way...
Changing UIApplication base class
Oct 30, 2019, 12:29 AM
When developing an iOS application you might get into a situation when you need to change the UIApplication base class. It is often a requirement when using various MDM SDKs, like the Mobile Iron AppConnect SDK. There are two ways to do...
Creating iOS context menu with highlight and dim
Aug 14, 2019, 12:29 AM
The iOS messaging application I work on features a context menu in the chat. You long-press any message in the chat and the context menu appears. This menu was originally implemented using the standard UIMenuController.
Changing UIAlertAction text color
Jun 26, 2019, 12:29 AM
If you use the standard iOS UIAlertController to present the user with a list of actions, there is not much you can do about styling each of the UIAlertActions shown.
The text of the shown UIAlertAction uses the UIView's tint color, so you...
Adding Wi-Fi and Bluetooth to hackintosh to enable Apple-specific features
Jun 12, 2019, 12:29 AM
When I started with my hackintosh I did not have Wi-Fi or Bluetooth support in it. I used Ethernet to connect to my home network and it worked fine, I had no need for Wi-Fi.
Later I wanted to use more “Apple-specific” features,...