Questions tagged [swiftui-toolbar]

17 questions
18
votes
7 answers

SwiftUI - Adding a keyboard toolbar button for only one TextField adds it for all TextFields

Background I have two TextFields, one of which has a keyboard type of .decimalPad. Given that there is no 'Done' button when using a decimal pad keyboard to close it, rather like the return key of the standard keyboard, I would like to add a 'Done'…
Jimbo
  • 25,790
  • 15
  • 86
  • 131
3
votes
1 answer

How to switch between tabBar and toolbar swiftUI?

In the files App after you pressed the Select button the tabBar switch to the toolbar. How can I do this with swiftUI?(Switch between tabBar and toolbar) struct tabBar: View { var body: some View { TabView { …
fdvfarzin
  • 1,107
  • 1
  • 4
  • 14
3
votes
1 answer

Toolbar jumping in place when view appears

I have a view with a toolbar at the bottom that I am navigating to using a NavigationLink. But when the view appears, the toolbar is shown a little too low. After half a second or so it then suddenly jumps into place. It only happens the first time…
Robin Bork
  • 297
  • 2
  • 8
2
votes
0 answers

How to add a keyboard toolbar in SwiftUI that remains even when keyboard not visible

I have a chat app and want to add a toolbar to the keyboard similar to an inputAccessoryView previously prior to SwiftUI. I know iOS15 now has the option to add a toolbar using the following (from hackingwithswift) .toolbar { …
alionthego
  • 8,508
  • 9
  • 52
  • 125
1
vote
0 answers

SwiftUI Toolbar bottombar background color will not change

I'm trying to change the color of my toolbar. I found the code .toolbarBackground(Color.blue, for: .navigationBar) and tried to place it in different position in my code but without any success. here is an example code with my bottombar. I would…
1
vote
1 answer

How to create a custom toolbar?

I want to have a sticky toolbar that has multiple different filtering options above a List in SwiftUI. Is there a way to just place a full custom view inside the .toolbar property of a List? With the below code, things look very unexpected var body:…
yambo
  • 1,388
  • 1
  • 15
  • 34
0
votes
0 answers

SwiftUI Toolbar Issue with iOS 15

This code, which displays a toolbar button to toggle the "bookmarked" property of a model object, works as intended in an iPhone simulator running iOS 16.0: class Item: ObservableObject { @Published var bookmarked = false } struct ContentView:…
protasm
  • 1,209
  • 12
  • 20
0
votes
0 answers

Add space between NavigationStack toolbar and other elements

I am trying to add space between the yellow toolbar and the MiniView element below. When I add space, it looks like it extends the toolbar. The space needs to be similar to the space between the MiniView and List. import SwiftUI struct AnotherView:…
thenakulchawla
  • 5,024
  • 7
  • 30
  • 42
0
votes
3 answers

How to add space between NavigationStack elements and NavigationStack toolbar

What: add space between the list inside a Navigation Stack and the toolbar on top. Current code is like this struct ContentView: View { let words = ["Hello", "World", "SwiftUI", "OpenAI", "ChatGPT"] var body: some View { …
thenakulchawla
  • 5,024
  • 7
  • 30
  • 42
0
votes
2 answers

SwiftUI - Missing Toolbar Button

The following sample code illustrates an issue I am having with my SwiftUI app: import SwiftUI struct ContentView: View { var body: some View { NavigationView { Text("Hello, world!") .toolbar { …
protasm
  • 1,209
  • 12
  • 20
0
votes
1 answer

toolbar animation on extending search bar does not work swiftui

I want to animate the extending search bar. When I press the search button, I want to extend the search bar to left, and when I close the search text field, to collapse to right. ToolbarItem(placement: .automatic) { …
0
votes
0 answers

How to display the menu uncollapsed on navigationBar?

I want to display a picker with several options to choose one of them. I could do it but the problem is that the menu shows collapsed. How can I show the menu display uncollapsed? Example Code: struct TestingView: View { enum Options: String,…
Ariel Antonio Fundora
  • 1,330
  • 15
  • 20
0
votes
1 answer

Present sheet with a TextField and its keyboard in a single animation?

I'm building a SwiftUI to-do app. You tap an Add button that pulls up a partial-height sheet where you can enter and save a new to-do. The Add sheet's input (TextField) should be focused when the sheet appears, so in order to keep things feeling…
0
votes
0 answers

How to create a new toolbar navigation link on each new view and link back to previous view?

Need to create a new toolbar navigation link on each new view going to the next item in the array and back button going to previous item. Currently, it doesn't do that and keeps creating a new toolbar navigationlink on the same view when a new item…
0
votes
2 answers

SwiftUI: Logout and switch screens from a popover

In my app, I have a View which is set to either a login View or a home TabView, depending on if the user is logged in. From the TabView, the user can go to a profile popover and logout. I want to switch back to the login View from this popover. I…
1
2