Closed Urkman closed 2 years ago
Thank you for bringing this up. Looks like there would have to be extensive work done to HLTE to add support for the .toolbar
modifier. I'm still deciding if this should be a supported feature.
In the mean time, I would recommend adding the button through UIKit.
HighlightedTextEditor(text: $text, highlightRules: .markdown)
.introspect { editor in
let controller = UIHostingController(
rootView: Button("Click me") { print("clicked") }
.padding(.bottom)
.border(Color.red)
)
editor.textView.inputAccessoryView = controller.view
}
For more, look up how to add buttons to the keyboard in UIKit.
Finally I found some time to test this. But it is not working for me. The Button is not tapable :(
You're right. Apologies for posting bad sample code. To be honest, I'm not great with UIKit and am not the best resource for help with this. I'd recommend researching how to add UIButton
s to the inputAccessoryView
(e.g. not using UIHostingController
).
Closing this since UIKit work is outside the scope of this library.
I would like to add a Toolbar to the keyboard for the TextView. How can I solve this?
Using this is not working: