SwiftUI – Adding title between navigation bar button items on a modal

I have a view which I present as a modal view. In this view, I wish to have a button on the top left, another button on the top right and a text horizontally centered between both the buttons. I was able to place the buttons correctly using "navigationBarItems", but it doesn’t allow me to… Read More SwiftUI – Adding title between navigation bar button items on a modal

ActionSheet opens on wrong index than clicked index

Action sheet is not opening to the right clicked index, it always opens to the wrong index. Code snippet is- Steps are: 1: here passing data to LazyVGrid 2: A View that have some image, text and three dot button 3: A common view that will handle the post tap event LazyVGrid(columns: SizeConfig.GridLayout.adaptiveGridItemLayout_140) { ForEach(folderData)… Read More ActionSheet opens on wrong index than clicked index

SwiftUI: Navigate from a view with a navigationbackbutton to a fullscreen view

I am making a menu for my game using NavigationView and NavigationLink. I have three views as such: struct MainMenuView: View { var body: some View { NavigationView { // relevant stuff NavigationLink(destination: CustomGameSettingsView()) { Text("Custom Game") } } } } struct CustomGameSettingsView: View { var body: some View { NavigationView { // ui to… Read More SwiftUI: Navigate from a view with a navigationbackbutton to a fullscreen view

Body Render Issue with NavigationStack in XCode 14 Beta

In the following code, background color of the ContentView doesn’t change after two seconds. struct ContentView: View { @State private var bool: Bool = false var body: some View { NavigationStack(root: { Group(content: { if bool { Color.red } else { Color.blue } }) .onAppear(perform: { DispatchQueue.main.asyncAfter(deadline: .now() + 1, execute: { print(">>>") bool =… Read More Body Render Issue with NavigationStack in XCode 14 Beta

How to rebuild a NavigationView in SwiftUI

I’m rebuilding one of my apps in SwiftUI and wanted to add FaceID unlock. I found and used this article to add LocalAuthentication: https://medium.com/swlh/app-lock-with-face-id-touch-id-in-swiftui-2-0-feef21e8eba7 While the code does handle the authentication part in the way that I need it to (although I’m showing the "locked view" as a sheet) it does result in one nasty… Read More How to rebuild a NavigationView in SwiftUI