Equally as simple no there is no way to do it. SwiftUI is for basic coding, it is a starter package.
But if you tap into UIKit
where the magic really happens it doesn't get any simpler than picking what you want to modify and telling it what you want it to be.
The code below is for the navigation bar in general, background, title, back button image, back button title, etc. It affects your entire App. It is not complete there are some quicks to it but you should get a decent picture on how to make it your own.
struct HomeView: View{
@State var ispresented = true
var body: some View {
ZStack {
NavigationView {
NavigationLink(
destination: ListView(),
isActive: $ispresented,
label: {
Text("List View")
}).navigationTitle("Home")
}
}
}
}
struct ListView: View{
init() {
}
var body: some View {
ZStack {
List{
Text("List")
}.navigationTitle("Sample")
}
}
}
struct HomeView_Previews: PreviewProvider {
static var previews: some View {
HomeView()
}
}
extension UINavigationController {
override open func viewDidLoad() {
super.viewDidLoad()
//.inline
let standard = navigationBar.standardAppearance
standard.backgroundColor = .blue
standard.titleTextAttributes = [NSAttributedString.Key.foregroundColor : UIColor.yellow,NSAttributedString.Key.font: UIFont(name: UIFont.familyNames[4], size: 20)!]
//This one is for standard and compact
standard.setBackIndicatorImage(UIImage(systemName: "checkmark"), transitionMaskImage: UIImage(systemName: "checkmark"))
//Landscape
let compact = navigationBar.compactAppearance
compact?.backgroundColor = .blue
compact?.titleTextAttributes = [NSAttributedString.Key.foregroundColor : UIColor.red]
//.large
let scrollEdge = navigationBar.standardAppearance
//This image overrides standard and compact
scrollEdge.setBackIndicatorImage(UIImage(systemName: "plus"), transitionMaskImage: UIImage(systemName: "plus"))
scrollEdge.backgroundColor = .blue
scrollEdge.largeTitleTextAttributes = [NSAttributedString.Key.foregroundColor : UIColor.green,NSAttributedString.Key.font: UIFont(name: UIFont.familyNames[2], size: 48)!]
scrollEdge.backButtonAppearance.normal.titleTextAttributes = [NSAttributedString.Key.foregroundColor : UIColor.magenta]
navigationBar.standardAppearance = standard
navigationBar.compactAppearance = compact
navigationBar.scrollEdgeAppearance = scrollEdge
//This color the Back Button Image
navigationBar.tintColor = .brown
}
}