Close Menu
  • Home
  • AI
  • Big Data
  • Cloud Computing
  • iOS Development
  • IoT
  • IT/ Cybersecurity
  • Tech
    • Nanotechnology
    • Green Technology
    • Apple
    • Software Development
    • Software Engineering

Subscribe to Updates

Get the latest technology news from Bigteetechhub about IT, Cybersecurity and Big Data.

    What's Hot

    How to Hire Offshore Software Developers

    November 17, 2025

    Amazon is seeking to raise about $12B through a bond sale, its first such deal in US dollars since 2022, to help fund acquisitions, capex, and more (Bloomberg)

    November 17, 2025

    Why Puppy Yoga Is the New Wellness Fix for Busy Americans

    November 17, 2025
    Facebook X (Twitter) Instagram
    Facebook X (Twitter) Instagram
    Big Tee Tech Hub
    • Home
    • AI
    • Big Data
    • Cloud Computing
    • iOS Development
    • IoT
    • IT/ Cybersecurity
    • Tech
      • Nanotechnology
      • Green Technology
      • Apple
      • Software Development
      • Software Engineering
    Big Tee Tech Hub
    Home»iOS Development»ios – SwiftUI Keyboard Toolbar not Displaying
    iOS Development

    ios – SwiftUI Keyboard Toolbar not Displaying

    big tee tech hubBy big tee tech hubOctober 17, 2025002 Mins Read
    Share Facebook Twitter Pinterest Copy Link LinkedIn Tumblr Email Telegram WhatsApp
    Follow Us
    Google News Flipboard
    ios – SwiftUI Keyboard Toolbar not Displaying
    Share
    Facebook Twitter LinkedIn Pinterest Email Copy Link


    I’m trying to display a toolbar with a done button on the keyboard. It works in isolation, but within the context of the app, the toolbar doesn’t display.

    The app has Home Screen View with buttons for navigation to other Views within the app, and a controller to keep track of the current view. Each section of the app has its own Navigation Stack. If I skip the main menu, the keyboard toolbar displays, but if I go through the main menu view first, it doesn’t.

    This seems like a bug in SwiftUI to me, but maybe there’s something else going on that I’m missing.

    Any help is appreciated.

    Here’s an extremely simplified example:

    import SwiftUI
    
    struct ContentView: View {
        
        @State private var rootViewController: RootViewController
            
        init(rootViewController: RootViewController) {
            self.rootViewController = rootViewController
        }
    
        var body: some View {
            switch rootViewController.currentView {
                case .formView:
                    FormView()
                case .home:
                    HomeView(rootViewController)
            }
        }
    }
    
    struct FormView: View {
        @State private var text: String = ""
        @FocusState private var isInputActive: Bool
        
        var body: some View {
            NavigationStack {
                Form {
                    TextField("Text", text: $text)
                        .keyboardType(.decimalPad)
                        .focused($isInputActive)
                    Text("Text: \(text)")
                }
                .navigationTitle("Keyboard Toolbar Test")
                .toolbar {
                    ToolbarItemGroup(placement: .keyboard) {
                        Spacer()
                        Button("Close") { isInputActive = false }
                    }
                }
                .padding()
            }
        }
    }
    
    struct HomeView: View {
        
        @State private var rootViewController: RootViewController
        
        init(_ rootViewController: RootViewController) {
            self.rootViewController = rootViewController
        }
     
         var body: some View {
             Button("Open Form") {
                 rootViewController.currentView = .formView
             }
        }
    }
    
    @Observable class RootViewController: CustomStringConvertible {
        var description: String {
            return switch(currentView) {
                case .home: "Home"
                case .formView: "Form View"
            }
        }
        
        enum Views {
            case home
            case formView
        }
    
        public var currentView: Views = .home // Does not work. Change to .formView, and it works
    }
    
    #Preview {
        ContentView(rootViewController: RootViewController())
    }
    



    Source link

    Displaying iOS Keyboard SwiftUI Toolbar
    Follow on Google News Follow on Flipboard
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email Copy Link
    tonirufai
    big tee tech hub
    • Website

    Related Posts

    ios – UserDefaults doesn’t store its value

    November 16, 2025

    ios – How to implement native Tab Bar search (.searchable) for a Dictionary view in SwiftUI?

    November 15, 2025

    react native – How can I use single finger scroll reliably in iOS in ScrollList while also allowing swipe left and swipe right?

    November 14, 2025
    Add A Comment
    Leave A Reply Cancel Reply

    Editors Picks

    How to Hire Offshore Software Developers

    November 17, 2025

    Amazon is seeking to raise about $12B through a bond sale, its first such deal in US dollars since 2022, to help fund acquisitions, capex, and more (Bloomberg)

    November 17, 2025

    Why Puppy Yoga Is the New Wellness Fix for Busy Americans

    November 17, 2025

    How to Navigate Cloud Migration Complexity: FAQs and Best Practices

    November 17, 2025
    About Us
    About Us

    Welcome To big tee tech hub. Big tee tech hub is a Professional seo tools Platform. Here we will provide you only interesting content, which you will like very much. We’re dedicated to providing you the best of seo tools, with a focus on dependability and tools. We’re working to turn our passion for seo tools into a booming online website. We hope you enjoy our seo tools as much as we enjoy offering them to you.

    Don't Miss!

    How to Hire Offshore Software Developers

    November 17, 2025

    Amazon is seeking to raise about $12B through a bond sale, its first such deal in US dollars since 2022, to help fund acquisitions, capex, and more (Bloomberg)

    November 17, 2025

    Subscribe to Updates

    Get the latest technology news from Bigteetechhub about IT, Cybersecurity and Big Data.

      • About Us
      • Contact Us
      • Disclaimer
      • Privacy Policy
      • Terms and Conditions
      © 2025 bigteetechhub.All Right Reserved

      Type above and press Enter to search. Press Esc to cancel.