Instance Method

makeNSView(context:)

Creates the view object and configures its initial state.

Required.

Declaration

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

Parameters

context

A context structure containing information about the current state of the system.

Return Value

Your AppKit view configured with the provided information.

Discussion

You must implement this method and use it to create your view object. Configure the view using your app's current data and contents of the context parameter. The system calls this method only once, when it creates your view for the first time. For all subsequent updates, the system calls the updateNSView(_:context:) method.

See Also

Creating and Updating the View

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

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

Required.

struct NSViewRepresentableContext

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

associatedtype NSViewType

The type of view to present.

Required.