Generic Structure

NSViewRepresentableContext

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

Declaration

struct NSViewRepresentableContext<View> where View : NSViewRepresentable

Overview

An NSViewRepresentableContext 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 NSViewRepresentable 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

let coordinator: View.Coordinator

An instance you use to communicate your AppKit view's behavior and state out to SwiftUI objects.

var transaction: Transaction

The current transaction.

Getting the Current Environment Data

var environment: EnvironmentValues

Environment data that describes the current state of the system.

See Also

Creating and Updating the View

func makeNSView(context: Self.Context) -> Self.NSViewType

Creates the view object and configures its initial state.

Required.

func updateNSView(Self.NSViewType, context: Self.Context)

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

Required.

associatedtype NSViewType

The type of view to present.

Required.