func makeUIView (context: Self.Context) -> Self.UIViewType
func updateUIView (Self.UIViewType , context: Self.Context)
associatedtype UIViewType : UIView
Availability 有効性
Technology
Use a UIView
instance to create and manage a UIView
object in your SwiftUI interface. Adopt this protocol in one of your app’s custom instances, and use its methods to create, update, and tear down your view. The creation and update processes parallel the behavior of SwiftUI views, and you use them to configure your view with your app’s current state information. Use the teardown process to remove your view cleanly from your SwiftUI. For example, you might use the teardown process to notify other objects that the view is disappearing.
解体処理を使って、あなたのビューをあなたのSwiftUIからきれいに取り除いてください。例えば、あなたは解体処理を使って、ビューが見えなくしている他のオブジェクトに通知します。
To add your view into your SwiftUI interface, create your UIView
instance and add it to your SwiftUI interface. The system calls the methods of your representable instance at appropriate times to create and update the view.
システムは、あなたの表現可能なインスタンスのメソッドを適時に呼び出して、ビューを作成および更新します。
The following example shows the inclusion of a custom My
structure in the view hierarchy.
struct ContentView: View {
var body: some View {
VStack {
Text("Global Sales")
MyRepresentedCustomView()
}
}
}
The system doesn’t automatically communicate changes occurring within your view to other parts of your SwiftUI interface. When you want your view to coordinate with other SwiftUI views, you must provide a Coordinator
instance to facilitate those interactions. For example, you use a coordinator to forward target-action and delegate messages from your view to any SwiftUI views.
例えば、あなたはあるコーディネータを使って、ターゲットアクションと委任先メッセージをあなたのビューからあらゆるSwiftUIビューへと転送します。
func makeUIView (context: Self.Context) -> Self.UIViewType
func updateUIView (Self.UIViewType , context: Self.Context)
associatedtype UIViewType : UIView
static func dismantleUIView (Self.UIViewType , coordinator: Self.Coordinator)
func makeCoordinator () -> Self.Coordinator
associatedtype Coordinator = Void
struct UIViewRepresentableContext
protocol UIViewControllerRepresentable
struct UIViewControllerRepresentableContext