UIViewController Extension to Display Alert

Here are two extension functions you can add on UIViewController which make it easy to display alerts. One of the functions will show an alert with a single action option, and the other will show an alert with two options. Read more…

How to Use Combine with Network API Calls in Swift

The Combine framework provides an alternative to using callbacks or delegate methods when loading data from a web API. It’s actually based on a completely different paradigm: Reactive Programming. By using Combine’s publishers, you can observe for value changes and react accordingly (e.g. reload a table view, update label values, etc). Read more…

How to Avoid Print Logging in Production Apps with Swift

There are a few reasons it’s a good idea to print to the console only while developing. The most important of these is security. Very often projects will print JSON requests and responses for debug purposes. This logging may contain passwords, API keys or other sensitive information. A malicious actor who was intent on it, could make their way into low levels of the app and pull information that was logged. Read more…

Create iOS Build Configurations for Test and Release

Build configurations in iOS development allow us to create specifications about how we want our app to be built. This makes it easy to compile an app for a particular environment (test, development, release, etc). Changing property values and executing code conditionally, depending on the environment, becomes essentially automatic. We’ll go through the steps to set this up below. Read more…

Allow Only Digits to Be Typed in a UITextField on iOS

It’s not uncommon to need to restrict UITextField to allow only digits to be typed in. This could be for credit card numbers, account numbers, payment amounts, etc. The easiest way to accomplish this in Swift is using the textField(_:shouldChangeCharactersIn:replacementString:) delegate method. Read more…

How to Detect a Change in Biometrics on iOS

If you are developing an app that deals with sensitive user information, such as financial or health, you may want to detect if a user added/removed a fingerprint from TouchID, or added/removed a face from FaceID. This can prevent a situation where someone gets ahold of the user’s device, then adds their own biometrics identification in order to get into the app. Read more…