|
In UIKit you can set What's the least hacky way to do this (I assume there's no built-in modifier that sets this like |
|
Ok, but… the code you've shown above does what you said is a band-aid, it creates a custom button that looks like it's the built-in text field clear button that iOS provides, but isn't one, right? I want to tell SwiftUI "I want this TextField to show exactly the thing that UITextField shows when configured with |
|
There is no native SwiftUI way to show that button at the present time. You have to either a) roll your own
I know it seems hacky, but that the way you do things in SwiftUI until Apple sees fit to give us a native way of doing it. |
|
You can also try the new With this you get the clear button and the magnifying glass icon for free! |
|
Just came up with this solution
|
|
|
|
RE: @NigelGee that merely gives you the appearance of a clear button, it does not come with the expected function of a clear button. the OP already knows about this when posting the question one year ago. |
SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure your entire paywall view without any code changes or app updates.
Sponsor Hacking with Swift and reach the world's largest Swift community!
You need to create an account or log in to reply.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.