Generic Structure


Contextual information about the state of the system that you use to create and update your UIKit view.


struct UIViewRepresentableContext<Representable> where Representable : UIViewRepresentable


A UIViewRepresentableContext structure contains details about the current state of the system. When creating and updating your view, the system creates one of these structures and passes it to the appropriate method of your custom UIViewRepresentable instance. Use the information in this structure to configure your view. For example, use the provided environment values to configure the appearance of your view. Don't create this structure yourself.


Coordinating View-Related Interactions

let coordinator: Representable.Coordinator

The view’s associated coordinator.

var transaction: Transaction

The current transaction.

Getting the Current Environment Data

var environment: EnvironmentValues

The current environment.

See Also

Creating and Updating the View

func makeUIView(context: Self.Context) -> Self.UIViewType

Creates the view object and configures its initial state.


func updateUIView(Self.UIViewType, context: Self.Context)

Updates the state of the specified view with new information from SwiftUI.


associatedtype UIViewType

The type of view to present.