Contents

UIViewRepresentableContext

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

Declaration

@MainActor @preconcurrency struct UIViewRepresentableContext<Representable> where Representable : UIViewRepresentable

Overview

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.

Topics

Coordinating view-related interactions

Getting the current environment data

Instance Methods

See Also

Adding UIKit views to SwiftUI view hierarchies