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 of
AdaptiveNavigation . Pass it a title string and an array of
You can instantiate an
AdaptiveNavigationItem similar to how you would use a
.tabViewItem . Pass it a destination and then a tuple containing an image and text, to make up the icon for Tabs and Sidebar list items.
See an example below.
If this was useful to you chuck us a follow on twitter! 😄