ios


Control, Target, and Action in iOS 14

The target–action pattern is one of the oldest in Cocoa, and it’s used with some of the most important interface objects, namely controls (UIControl). That includes buttons (UIButton), switches (UISwitch), segmented controls (UISegmentedControl), and many others. It is also used with UIBarButtonItem because it’s button-like even though it isn’t a control (or even a view). …

Control, Target, and Action in iOS 14 Read More »


Improvements in Testing in Xcode 12

Xcode 12, iOS 14, and Swift 5.3 bring with them a number of significant improvements in testing. If you live and die by tests — or even if you just wish you did — you’re going to be very happy to hear about these. Some of these changes actually appeared earlier, in Swift 5.2, Xcode …

Improvements in Testing in Xcode 12 Read More »


Xcode 12 — What a Pane

As iOS programmers, we live and breathe and have our being within Xcode, so it makes sense to be as familiar as possible with its capabilities, and to take advantage of whatever innovations allow us to get work done. But, ironically, as a new version of Xcode is released, exactly when noteworthy new features are …

Xcode 12 — What a Pane Read More »


Swift 5.2: Object References as Functions in Swift

Here’s a Swift language feature that you may not have noticed when it arrived in Swift 5.2. The following syntax can now be made legal: let p = Person(firstName: “Matt”, lastName: “Neuburg”) let s = p() print(s) // Matt Wait, what just happened? I treated an instance as a function, and it worked (in the …

Swift 5.2: Object References as Functions in Swift Read More »


Swift 5.2: No More Unsafe Pointer References

When people upgraded to Xcode 11.4, a lot of complaints started to appear on StackOverflow that code of the following form was giving trouble (this is an odd way to write this, but just bear with me): let color = // some UIColor var r = 0 as CGFloat var g = 0 as CGFloat …

Swift 5.2: No More Unsafe Pointer References Read More »


Swift 5.2: Keypaths Get a Promotion

When you’re busy programming, it’s easy to sleep through changes in the Swift language, especially minor changes; and Swift 5.2 (which emerged as part of Xcode 11.4) was definitely minor, especially in comparison with Swift 5.1. Still, this is an interesting little improvement worth knowing about. Suppose that a Person has a firstName and a …

Swift 5.2: Keypaths Get a Promotion Read More »


Testing Forward Compatibility in Xcode

At the time of this writing, we are in that betwixt-and-between period leading up to the release of iOS 14; Xcode 12, Big Sur, and iOS 14 itself are still in beta, but things could start to go final any day now. If you’ve got existing apps, there are various ways to prepare for that …

Testing Forward Compatibility in Xcode Read More »


How to Get Started With Pods

Pods, also known as CocoaPods, are a necessary evil. And they are ubiquitous. Even if you’ve never used them, you probably know that they exist, and you may even have a general sense of what they are, because questions about them come up on Stack Overflow all the time. Basically, Pods are code libraries that …

How to Get Started With Pods Read More »


Cool Swift Tricks 2: No Escape

This is the second of four posts about random little Swiftisms for you to amaze your friends and confound your enemies. All of these came up in my real code recently, and they really did surprise one or more of my co-workers. The Swift language has a lot of cool features hidden away in its …

Cool Swift Tricks 2: No Escape Read More »


Cool Swift Tricks 1: Mirror, Mirror

This is the first of four posts about random little Swift tips and tricks for you to amaze your friends and confound your enemies. All of these came up in my real code recently, and they really did surprise one or more of my co-workers. The Swift language has a lot of cool features hidden …

Cool Swift Tricks 1: Mirror, Mirror Read More »