-
-
Save sturdysturge/5eb85a14098bd3d4467df3e37c7d9cc3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
struct ContentView : View { | |
@State var text = "" | |
var body: some View { | |
VStack { | |
TextField("Add text here", text: $text) | |
UIKitVC(text: $text) | |
} | |
.padding() | |
} | |
} | |
struct UIKitVC: UIViewControllerRepresentable { | |
@Binding var text: String | |
func makeUIViewController(context: Context) -> ViewController { | |
ViewController() | |
} | |
func updateUIViewController(_ uiViewController: ViewController, context: Context) { | |
uiViewController.labelText.text = text | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment