April 2020
Beginner
316 pages
8h 20m
English
We'll start by covering how we set up and use the UIViewRepresentable protocol. Head on over to TextHelper.swift, where we can use the TextView we imported for reference.
First of all, you'll need to create a struct that you intend to use to represent the UIKit View you want to house. This will need to extend the UIViewRepresentable protocol with the following functions. Add the following code just outside of the TextView struct in TextHelper.swift:
struct TestRepresentableView: UIViewRepresentable { @Binding var text: String func makeUIView(context: Context) -> UITextView { return UITextView() } func updateUIView(_ uiView: UITextView, context: Context) { uiView.text = text } }
We'll go through them one at ...
Read now
Unlock full access