iOS
Swift 5.5: Asynchronous Looping With Async/Await
In an earlier article, I introduced the Swift 5.5 async/await syntax that lies at the heart of Swift’s new structured concurrency. To do so, I demonstrated how to replace a common use case of Grand Central Dispatch (GCD) — switching from the main thread to a background thread and then back to the main thread …
Swift 5.5: Asynchronous Looping With Async/Await Read More »
Swift 5.5: Replacing GCD With Async/Await
Multithreading! The mere word sends shivers up one’s spine. And if it doesn’t, it should. Main thread and background threads. Code that runs asynchronously. Code that can run simultaneously with other code. Code that can run simultaneously with itself. Code that can share data across threads — possibly with disastrous consequences. Concurrency. Multithreaded code is …
Taking Control of Rotation Animations in iOS
We all love to have animation in our app’s interface. But sometimes writing even the simplest animation can be rather elusive. Rotation is a case in point. As you probably know, the way to rotate a view (or a layer) is to change its transform, applying a rotation transform to it. But certain rotations are …
Little Swift Tricks: Boxing Multiple Types
Here’s a little Swift language trick I sometimes use — more often than you might suppose, actually. As I’m sure you know, Swift is very strict about the types of its objects. You have to declare clearly what type a reference is, and from then on, you have to stick to that. That’s one of …
Night Thoughts on Testing iOS In-App Purchases
What’s the business model for an iOS app? If you aren’t just distributing an app as a freebie out of the goodness of your heart (several of my apps do work that way), and if you aren’t being paid directly by a client to create or maintain the app in the first place, and if …
Picking a Photo in iOS 14
If your app puts up an interface where the user gets to choose a photo from the photos library, you’re probably familiar with UIImagePickerController. Indeed, you’re probably all too familiar with it. UIImagePickerController is a remarkably clunky, aged piece of interface, both from the user point of view and with regard to its programming API. …
Dealing with iOS 13 Deprecations
In an earlier article, I talked about the major and minor changes you might expect to grapple with when updating your older app to iOS 13 and iOS 14. In that article, however, I didn’t talk about deprecations. So I want to talk about them now. What is a deprecation? A deprecation is when [WARNING: …
Finishing Touches: Haptics
We are probably all so accustomed by now to haptic feedback on our iPhones that we hardly give it a thought. Here are some examples: On the home screen, long press on the background, and the screen enters “jiggly mode” — with a dull thud. On the home screen, long press an app or a …