This is apparently happening on the Xs running 15.1 that I can see. I DO NOT see those Nav Links on my test iPad running 15.1. Reference my original images (Xs Device vs Simulator). The iPad Device & Simulator do not have those extra Nav link lines. All the previous without using ZStack at all. Add ZStack per my 2nd code submittal & the links show like in your images depending on where the ZStack is placed. Point is ... I don't want to see those on my Xs Device, which seems to be the only device that has this issue.
Post
Replies
Boosts
Views
Activity
I guess I'm missing your point? I see the NavigationLink just below the Game View Area Text? In my case the Game View Area takes up the entire screen EXCEPT the the 2 navigation buttons area. So if I have the links ADDED to the display, it shows the Game View Area AND then links stacked Vertically, which essentially compresses the game area to a smaller area than required.from the real game area. My 1st set of images depict exactly that. As of now the ONLY way I can get full game area as desired is to have the ZStack so it puts the links in line with the buttons and I lose NO game area as shown in my last image.
Here is ENTIRE test app that replicates the issue on my iPhone Xs running 15.1
//
// AppInfoView.swift
// TestApp
//
import SwiftUI
struct AppInfoView: View {
var body: some View {
Text("Application Info")
}
}
//
// ContentView.swift
// TestApp
//
import SwiftUI
struct ContentView: View {
@EnvironmentObject var gameView: GameViewController
@State private var selection: String? = nil
@State private var showSettingsAlert = false
@State private var showInfoAlert = false
init() {
UINavigationBar.appearance().backgroundColor = .clear
}
var body: some View {
NavigationView {
// ZStack{
// NavigationLink(destination: SettingsView(), tag: "Settings", selection: $selection) { EmptyView() }
// NavigationLink(destination: AppInfoView(), tag: "Info", selection: $selection) { EmptyView() }
VStack{
GameUIView()
ZStack{
NavigationLink(destination: SettingsView(), tag: "Settings", selection: $selection) { EmptyView() }
NavigationLink(destination: AppInfoView(), tag: "Info", selection: $selection) { EmptyView() }
HStack{
Button( action: {
self.selection = "Settings"
if gameView.gameStarted && !gameView.gamePaused {
self.showSettingsAlert = true
}
}) {
Text("Game Settings")
.font(.system(size: (CGFloat(16)), weight: .bold, design: .serif))
.foregroundColor(.blue)
Image(systemName: (showSettingsAlert ? "gearshape.fill" : "gearshape"))
.font(.system(size: (CGFloat(16)), weight: .bold, design: .serif))
}
.alert(isPresented: $showSettingsAlert) {
Alert(title: Text("Cannot View or Change Settings!"), message: Text("Game is Running or Game is NOT Paused!! Must not be running or else in Pause State to view Game Settings!"), dismissButton: .default(Text("Got it!")))
}
Spacer()
Button( action: {
self.selection = "Info"
if gameView.gameStarted && !gameView.gamePaused {
self.showInfoAlert = true
}
}) {
Text("Game Info")
.font(.system(size: (CGFloat(16)), weight: .bold, design: .serif))
.foregroundColor(.blue)
Image(systemName: (showInfoAlert ? "questionmark.diamond.fill" : "questionmark.diamond"))
.font(.system(size: (CGFloat(16)), weight: .bold, design: .serif))
}
.alert(isPresented: $showInfoAlert) {
Alert(title: Text("Cannot View Application Info!"), message: Text("Game is Running or Game is NOT Paused!! Must not be running or else in Pause State to view Game Information!"), dismissButton: .default(Text("Got it!")))
}
.navigationBarHidden(true)
.navigationBarTitle("Back To Game", displayMode: .inline)
}
}
}
// }
.navigationViewStyle(StackNavigationViewStyle())
.alert(isPresented: $gameView.gameEnded, content: {
Alert(title: Text("Game Has Ended"), message: Text("To play game again you MUST close app and restart!"), dismissButton: .default(Text("Got it!")))
})
}
}
}
//
// GameUIView.swift
// TestApp
//
import SwiftUI
struct GameUIView: View {
var body: some View {
Spacer()
Text("Game View Area")
Spacer()
}
}
//
// GameViewController.swift
// TestApp
//
import Foundation
import UIKit
class GameViewController: UIViewController, ObservableObject {
@Published var gameStarted = Bool(false)
@Published var gamePaused = Bool(false)
@Published var gameEnded = Bool(false)
}
//
// SettingsView.swift
// TestApp
//
import SwiftUI
struct SettingsView: View {
var body: some View {
Text("Settings")
}
}
putting where you state .... image is same as first image (left). putting Zstack AFTER the VStack looks like last image provided.
ZStack merely relocated the small rectangles (NavigationLinks) between the Settings & Info selectors (i.e., overlayed there)?
Sent this to Apple and they have not responded to this. Since you had no issue on your device, I'm beginning to believe it's iOS 15.1 AND iPhone Xs related because 15.1 on my test iPad is fine!
Still has the problem. EXCEPT the links appear BIGGER than before?