Better Programming

Advice for programmers.

Follow publication

Member-only story

Implementing TextFieldDelegate With Native SwiftUI

Understand TextFieldDelegate methods with native SwiftUI

Mark Lucking
Better Programming
Published in
3 min readSep 15, 2021

Photo by Dries Augustyns on Unsplash

Here we are, less than a week away from the production release of iOS 15 and I am still hearing SwiftUI isn’t ready for production. It is sadly becoming an urban myth.

Is it true or is it that the establishment isn’t trying hard enough? To be honest, there is some truth in it. TextView and ScrollView are both good examples of UI elements in UIKit that in the premier case don’t exist in SwiftUI or the latter that has only been partially implemented. But it is very much a moving target and with a little bit effort, you can get some remarkably good results.

And well given the layout capabilities of SwiftUI are light years ahead of UIKit, I think it may be worth it.

Let’s look at another example, the TextField. This has been implemented in SwiftUI, but like ScrollView doesn’t come across as a full implementation on the surface of it. Join me on a journey to look into this with a little more vigor. I want to try and implement the TextField with all the trimmings without resorting to UIViewRepresentable. I want a native solution.

The Brief

The TextField in UIKit comes with a delegate to help you use it. Within the delegate protocol, I find…

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Mark Lucking
Mark Lucking

Written by Mark Lucking

Coding for 35+ years, enjoying using and learning Swift/iOS development. Writer @ Better Programming, @The StartUp, @Mac O’Clock, Level Up Coding & More

No responses yet

Write a response