Post

Replies

Boosts

Views

Activity

Reply to SwiftUI - Placing ToolbarItem on .keyboard does not work
There is a workaround! The solution may not for work for everyone but at least it is worth a try. I had to show (and hide) a sheet right after entring the view. Miraculously the toolbar starts to appear after that. Be advised that this code requires iOS 16.4 and above. If you remove .presentationBackground(.clear) it is available for lower targets. struct YourView: View { @State var isShowingAWorkAround = true var body: some View{ HSTack { // you code here } .sheet(isPresented: $isShowingWorkAround) { TemporarySheet { self.isShowingAufmass = false } resetCallback: { self.isShowingWorkAround = false }.presentationBackground(.clear) } } } Code for TemporarySheet struct TemporarySheet: View { let dismissCallback: (() -> Void) let resetCallback: (() -> Void) var body: some View { Text("").onAppear { self.dismissCallback() }.onDisappear { self.resetCallback() } } } Sure you can take anything instead Text(""). Tested on iOS 17.2 public beta (which has identical problem as 17.1).
Dec ’23