iOS Posts
SwiftUI doesn’t yet have an easy way to access the camera or photo library. hackingwithswift.com already has a great tutorial on how to access the camera from SwiftUI.
Read more »Occasionally in an iOS app you’ll do something asynchronous, calling a completion handler when it’s done, like this:
Read more »Swift’s Error
protocol is commonly used across Apple’s APIs to represent failure states.
Note: This post has embedded tweets which may set cookies. The rest of this website doesn’t use cookies at all.
Read more »Recently while developing a workout sharing feature for my app Personal Best, I needed to figure out how to turn a SwiftUI view into an image that people could share.
Read more »Since iOS 14, SwiftUI has included components for adding maps to your apps.
Read more »I came to SwiftUI from the React world, where it’s common to pass views (components in React terminology) to other views:
Read more »Swift has long had the ability to omit argument labels to aid readability:
Read more »SwiftUI 2 comes with a Map component, for displaying views from Apple Maps in your apps.
Read more »Here’s a SwiftUI list with a section header:
Read more »I keep running into an issue in SwiftUI where some text truncates where I don’t expect it to. Here’s an example from Personal Best’s onboarding screen:
Read more »Note: This article was written for iOS 13. iOS 14 has support for page controls built in. There is also now iPages, a great third-party library you can use for this.
Read more »In SwiftUI, you can achieve most UI needs without ever explicitly checking for dark mode, thanks to semantic colours built into the platform and the ability to define our own semantic colours that automatically adapt to dark mode.
Read more »When building a watchOS extension for my iPhone app Personal Best, I couldn’t figure out why querying the HealthKit store for workouts was only returning 25 results, as opposed to over 700 on iPhone.
Read more »Recently I’ve been trying to use HKObserver
to monitor queries from HealthKit in the background. I wrote a simple integration where my app would print to the console every time a new workout was recorded. However, it was never triggered, except when I opened my app in the foreground.
Apple’s human interface guidelines specify that tap targets should be at least 44x44pt to ensure they’re easily tappable.
Read more »@EnvironmentObject
is handy for passing data between views in SwiftUI. Hacking With Swift has an excellent guide on how to use it, but when I followed it, one some of my views it just wasn’t working correctly.