Contents

preferredPencilSqueezeAction

The action that the user prefers to perform when squeezing their Apple Pencil, as selected in the Settings app.

Declaration

var preferredPencilSqueezeAction: PencilPreferredAction { get }

Discussion

You can read this value by creating a property with the Environment property wrapper and using it inside the action closure of the onPencilSqueeze(perform:) view modifier as an indication of what to do when the user squeezes their Apple Pencil:

@Environment(\.preferredPencilSqueezeAction) private var preferredAction

var body: some View {
    MyDrawingCanvas()
        .onPencilSqueeze { phase in
            switch (phase, preferredAction) {
                ...
            }
        }
}

In macOS, this value cannot be changed by users and is always set to showContextualPalette.

See Also

Recognizing Apple Pencil gestures