RawRepresentable using a NSKeyedArchiver
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.
The @AppStorage natively supports
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. …
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…
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
Simple replace your root navigation view with an instance…
I make apps for the AppStore. Currently working on an app that makes gardening easier. Twitter: @iamzanecarter