Sign in

Conforming to RawRepresentable using a NSKeyedArchiver

Photo by Yousef Espanioly on Unsplash

iOS 14 came with some exciting new features for SwiftUI and one of my favorites is the @AppStorage wrapper. This new property wrapper makes storing a value in UserDefaults way easier. Prior to iOS 14, this would have to be done by using getter and setter methods.

@AppStorage Documentation

The @AppStorage natively supports Bool, Int, String, URL & Data. But what if you want to display more complicated data types? For example, a SwiftUI Color. I came across this problem myself developing one of my own apps. …


When @State property wrapper is broken, use @StateObject

Photo by Joseph Barrientos on Unsplash

If your trying to display dynamic content in a single sheet on iOS 14 with SwiftUI you may have come across this problem.

In my case, I had multiple buttons launching different views inside of the same sheet using a state variable. You would click one button and an empty sheet would popup. Where the hell is my content? If you click a different button straight after, it works. But whatever button you click first will fail to display the correct content until a second button is clicked beforehand.

Really strange right? What makes it even more confusing is that…


Let’s add backward-compatibility support for the latest SwiftUI feature

Computer on desk
Computer on desk
Photo by Patrick Ward on Unsplash.

With the release of iOS 14, SwiftUI gained some powerful new features. But if you're still stuck supporting iOS 13 platforms, then that doesn't do you much good, does it?

I recently needed to use the onChange view modifier in a project, but I soon came to realise that it’s not supported on iOS 13 deployment targets. Here’s the big fat error XCode gave me:


Thanks to iOS 14 & SwiftUI, making Universal Apps has become even easier. Making Navigation look good on both iPad and iPhone can still be a bit tricky though. TabBars make sense on iPhone but on iPad they can look a bit out of place. One good alternative is using the new sidebar.

Defining the same set of views for navigating twice (Once for iPad and Once for iPhone) is not the cleanest way to achieve this though.

For one of my Apps I solved this by creating an AdaptiveNavigation view.

Simple replace your root navigation view with an instance…

Zane Carter

I make apps for the AppStore. Currently working on an app that makes gardening easier. Twitter: @iamzanecarter

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store