Fix macOS bug where the navigation title interferes with back button

This commit is contained in:
2025-05-27 19:41:34 -04:00
parent 9e4baf1517
commit 4e8907d52d
2 changed files with 50 additions and 47 deletions

View File

@@ -9,51 +9,54 @@ import SwiftUI
struct MainView: View {
var body: some View {
VStack {
NavigationStack {
Image("bigicon").resizable().frame(width: 150.0, height: 150.0)
Text("Nostash").font(.title)
Text("A Safari Nostr Extension").font(.title2)
NavigationLink("Privacy Policy") {
PrivacyPolicyView()
}
#if macOS
.buttonStyle(.link)
#endif
.padding(.all, 3.0)
NavigationLink("Getting Started: iPhone") {
GettingStartediPhone()
}
#if macOS
.buttonStyle(.link)
#endif
.padding(.all, 3.0)
NavigationLink("Getting Started: iPad") {
GettingStartediPad()
}
#if macOS
.buttonStyle(.link)
#endif
.padding(.all, 3.0)
NavigationLink("Getting Started: Mac") {
GettingStartedMac()
}
#if macOS
.buttonStyle(.link)
#endif
.padding(.all, 3.0)
NavigationLink("Tips and Tricks") {
TipsAndTricks()
}
#if macOS
.buttonStyle(.link)
#endif
.padding(.all, 3.0)
NavigationStack {
Image("bigicon").resizable().frame(width: 150.0, height: 150.0)
Text("Nostash").font(.title)
Text("A Safari Nostr Extension").font(.title2)
NavigationLink("Privacy Policy") {
PrivacyPolicyView()
}
#if os(macOS)
.buttonStyle(.link)
#endif
.padding(.all, 3.0)
NavigationLink("Getting Started: iPhone") {
GettingStartediPhone()
}
#if os(macOS)
.buttonStyle(.link)
#endif
.padding(.all, 3.0)
NavigationLink("Getting Started: iPad") {
GettingStartediPad()
}
#if os(macOS)
.buttonStyle(.link)
#endif
.padding(.all, 3.0)
NavigationLink("Getting Started: Mac") {
GettingStartedMac()
}
#if os(macOS)
.buttonStyle(.link)
#endif
.padding(.all, 3.0)
NavigationLink("Tips and Tricks") {
TipsAndTricks()
}
#if os(macOS)
.buttonStyle(.link)
#endif
.padding(.all, 3.0)
}
.toolbar {
// There is a macOS bug where the back button overlaps the title in the navigation bar.
// Adding an empty Text element fixes the issue apparently.
Text("")
}
}
}

View File

@@ -10,11 +10,11 @@ import SwiftUI
@main
struct NostashApp: App {
var body: some Scene {
WindowGroup("Nostash") {
WindowGroup {
MainView()
}
#if macOS
#if os(macOS)
.defaultSize(width: 400, height: 500)
#endif
#endif
}
}