One Logo Pool Ball
PencilKit · IOS API REFERENCE

PKToolPickerCustomItem.Configuration

struct · iOS 18.0+ · SDK 27.1

struct Configuration

A configuration that specifies the appearance and behavior of a item and its contents.

Members (17)

init · iOS 18.0+

init

TypeScript
static init(identifier: string, name: string): PKToolPickerCustomItem_Configuration
Swift declaration
init(identifier: String, name: String)

Create a new configuration. - Parameters: - identifier: The identifier for the tool item. - name: The name for the tool item.

get · iOS 18.0+

identifier

TypeScript
get identifier(): string
Swift declaration
var identifier: String

A string that identifies the item in the picker. For example, com.example.myapp.toolpicker.pencil. If multiple items with the same identifier are used to create the picker, only the first instance is used.

set · iOS 18.0+

identifier

TypeScript
set identifier(value: string)
Swift declaration
var identifier: String

A string that identifies the item in the picker. For example, com.example.myapp.toolpicker.pencil. If multiple items with the same identifier are used to create the picker, only the first instance is used.

get · iOS 18.0+

defaultColor

TypeScript
get defaultColor(): _UIKit_UIColor
Swift declaration
var defaultColor: UIColor

Default color for the tool. Defaults to black.

set · iOS 18.0+

defaultColor

TypeScript
set defaultColor(value: _UIKit_UIColor)
Swift declaration
var defaultColor: UIColor

Default color for the tool. Defaults to black.

get · iOS 18.0+

defaultWidth

TypeScript
get defaultWidth(): number
Swift declaration
var defaultWidth: CGFloat

Default width for the tool. Defaults to 0.0.

set · iOS 18.0+

defaultWidth

TypeScript
set defaultWidth(value: number)
Swift declaration
var defaultWidth: CGFloat

Default width for the tool. Defaults to 0.0.

get · iOS 18.0+

imageProvider

TypeScript
get imageProvider(): (((arg0: PKToolPickerCustomItem) => Promise<_UIKit_UIImage>)) | null
Swift declaration
var imageProvider: ((PKToolPickerCustomItem) -> UIImage)?

A closure to provide an image representing the given tool item. Return an image at least 150 points tall to avoid the bottom of the item showing during animations. By default, PencilKit uses `name` to label the tool item for accessibility. To override this, set the `accessibilityLabel` of the image returned from this closure.

get · iOS 18.0+

widthVariants

TypeScript
get widthVariants(): Record<number, _UIKit_UIImage>
Swift declaration
var widthVariants: [CGFloat : UIImage]

A dictionary representing the UI options for choosing width variants, with each element containing its width value paired with its corresponding image. A dictionary with fewer than 2 elements means no selection UI is available for users to adjust the width value. A dictionary with 2 or more elements means that users can adjust the width value using the selection UI. Provide square images with a size of at least 32pts by 32pts.

set · iOS 18.0+

widthVariants

TypeScript
set widthVariants(value: Record<number, _UIKit_UIImage>)
Swift declaration
var widthVariants: [CGFloat : UIImage]

A dictionary representing the UI options for choosing width variants, with each element containing its width value paired with its corresponding image. A dictionary with fewer than 2 elements means no selection UI is available for users to adjust the width value. A dictionary with 2 or more elements means that users can adjust the width value using the selection UI. Provide square images with a size of at least 32pts by 32pts.

get · iOS 18.0+

allowsColorSelection

TypeScript
get allowsColorSelection(): boolean
Swift declaration
var allowsColorSelection: Bool

Present color selection UI to the user. Note that the custom item has a mutable version of this property. This property provides its initial value. Defaults to false.

set · iOS 18.0+

allowsColorSelection

TypeScript
set allowsColorSelection(value: boolean)
Swift declaration
var allowsColorSelection: Bool

Present color selection UI to the user. Note that the custom item has a mutable version of this property. This property provides its initial value. Defaults to false.

get · iOS 18.0+

toolAttributeControls

TypeScript
get toolAttributeControls(): PKToolPickerCustomItem_ControlOptions
Swift declaration
var toolAttributeControls: PKToolPickerCustomItem.ControlOptions

Defines which attribute controls are available to be presented in UI such as the tool attributes popover, or inline in the picker presented from a pencil squeeze. Controls for properties which the tool item does not support will not be presented. Excluding a control here does not hide all UI for adjusting that value. For example, excluding the opacity control here will not remove it from the color picker, if the color picker is otherwise available. Defaults to all controls.

set · iOS 18.0+

toolAttributeControls

TypeScript
set toolAttributeControls(value: PKToolPickerCustomItem_ControlOptions)
Swift declaration
var toolAttributeControls: PKToolPickerCustomItem.ControlOptions

Defines which attribute controls are available to be presented in UI such as the tool attributes popover, or inline in the picker presented from a pencil squeeze. Controls for properties which the tool item does not support will not be presented. Excluding a control here does not hide all UI for adjusting that value. For example, excluding the opacity control here will not remove it from the color picker, if the color picker is otherwise available. Defaults to all controls.

get · iOS 18.0+

viewControllerProvider

TypeScript
get viewControllerProvider(): (((arg0: PKToolPickerCustomItem) => Promise<_UIKit_UIViewController>)) | null
Swift declaration
var viewControllerProvider: ((PKToolPickerCustomItem) -> UIViewController)?

A closure to provide a view controller above the system controls in the tool attributes popover.

get · iOS 18.0+

name

TypeScript
get name(): string
Swift declaration
var name: String

A short string suitable for presentation to users as the name of the tool.

set · iOS 18.0+

name

TypeScript
set name(value: string)
Swift declaration
var name: String

A short string suitable for presentation to users as the name of the tool.

Skipped declarations

2 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.

PKToolPickerCustomItem.Configuration.imageProvider

closure property answers its caller

PKToolPickerCustomItem.Configuration.viewControllerProvider

closure property answers its caller

All PencilKit types →