So basically I have created UIKit
TextFields, I want to be able to take advantage of delegate functions from UIKit
and their return values, and use them to toggle let's say a @State variable in SwiftUI
. How would I be able to achieve this? A little more in-depth, I want to be able to use the isFirstResponder
dot method in UIKit
and return a specific textfield, then do something with that data to toggle its corresponding element 'on', that I made in SwiftUI
.
Asked
Active
Viewed 94 times
0

Bhadresh Kathiriya
- 3,147
- 2
- 21
- 41

Realm0910
- 13
- 3
-
The approach in [How do I create a multiline TextField in SwiftUI?](https://stackoverflow.com/a/58639072/12299030) should be helpful. – Asperi Jan 03 '20 at 05:37
1 Answers
0
To represent UIKit
views and view controllers in SwiftUI
, you create types that conform to the UIViewRepresentable
and UIViewControllerRepresentable
protocols. Your custom types create and configure the UIKit
types that they represent, while SwiftUI
manages their life cycle and updates them when needed.

Schaheer Saleem
- 479
- 1
- 3
- 12