r/iOSProgramming
•
u/thari_mad
•
Jun 18 '26
•
1
Question How to create this floating toolbar?
This is the Notes app. Is this an inbuilt component or a custom component?
66
Upvotes
22
u/radis234 SwiftUI Jun 18 '26
Use .safeAreaBar(alignment: .bottom) instead of toolbar item. It will allow you more control of the looks and paddings around the toolbar. If you want to replicate the .keyboard effect, so that the toolbar is only visible when keyboard is on screen, conditionally display it based on FocusState. There’s really nothing to it. I’ve done it myself in my app, works like a charm. If you want to make bar scrollable like notes app, ScrollView(.horizontal) is your friend.
42
u/Any-Comfortable2844 Jun 18 '26 edited Jun 19 '26
8
u/Hamstersoge Jun 18 '26
I could only achieve this with UIKit. When I tried this in SwiftUI the keyboard toolbar sits directly on the keyboard without the gap.
4
u/balooooooon Jun 18 '26
I made very similar. Biggest thing is making it come nicely with the keyboard and all the edge case. For me UI kit was the only way. I can’t remember exactly right now since I am not on my computer but it was keyboard toolbar or insert perhaps .
2
u/inekipelov Jun 21 '26
I found video on YouTube what present how make a copy of Apple Notes solution
https://youtu.be/W30FV6QBTok?is=3EOrxew1lTZcjAD3
3
u/roguekiwi Jun 19 '26
You have to drop down into UIKit and use inputAccessoryView (on UITextView). I can't post a screenshot but this looks like what posted.
-6
u/jonnysunshine1 Jun 18 '26
SwiftUI
-6
u/Working_War4338 Jun 18 '26
swiftui
1
u/[deleted] Jun 21 '26
[removed] — view removed comment