If you have a subview of a row in SwiftUI which is a button or contains a button, you may run into difficulty getting it to respond to touches. The row itself may receive the touch, instead of the button itself. Read more…
Create a Simple Stepper Element in SwiftUI
To create a stepper in SwiftUI, check out the following code. It will give you a basic element which you can build upon, or use as is. Read more…
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 Access an Enum Associated Value in Swift
There are multiple ways to access an enum associated value in Swift. One of the most common methods is using a switch statement. There is also a more concise way to pull an associated value out of a single enum case. Read more…
How to Set Up a UITableView Diffable Data Source in Swift
With the release of iOS 13, Apple introduced UITableViewDiffableDataSource for table views. This class eliminates the need for UITableViewDataSource and is a great way to dynamically update your table view’s data. 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…
- Page 1 of 2
- 1
- 2