|
Until SwiftUI gives us Accessory buttons for the keyboard, It looks like the best option is to use a UIViewRepresentable. My goal is to still have a cancel / clear / done button on top of the keyboard. The buttons show up on the keyboard, but when clicked do nothing. The textFieldShouldReturn is called and works properly. What am I missing? Oh, and I know the functions don't actually do anything but print to the console, but I can get that working.
|
|
Hey, It seems like you're missing some of the conceptual basics regarding Cocoa's target-action system. The
But since you don't seem to have much experience with target-action, I suggest you take a look at the "new"
Target-action is of course still a very valid approach, just throught I'd throw this here for completeness. |
BUILD THE ULTIMATE PORTFOLIO APP Most Swift tutorials help you solve one specific problem, but in my Ultimate Portfolio App series I show you how to get all the best practices into a single app: architecture, testing, performance, accessibility, localization, project organization, and so much more, all while building a SwiftUI app that works on iOS, macOS and watchOS.
Sponsor Hacking with Swift and reach the world's largest Swift community!
This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.