Contents

NSImage.SymbolConfiguration

An object that contains the specific font, style, and weight attributes to apply to a symbol image.

Declaration

class SymbolConfiguration

Overview

Symbol image configuration objects include details such as the point size, scale, text style, and weight to apply to your symbol image. The system uses these details to determine which variant of the image to use and how to scale or style the image.

if let image = NSImage(systemSymbolName: "multiply.circle.fill",
                       accessibilityDescription: "A multiply symbol inside a filled circle.") {
        
    var config = NSImage.SymbolConfiguration(textStyle: .body,
                                                     scale: .large)
    config = config.applying(.init(paletteColors: [.systemTeal, .systemGray]))
    imageView.image = image.withSymbolConfiguration(config)
}

NSImage.SymbolConfiguration objects are immutable after you create them. If you use the applying(_:) method on the object, the new image attributes replace any previous attributes you supplied. After creating a symbol configuration object, assign it to the symbolConfiguration property of the NSImageView object you use to display the image. If you draw the image directly, use the withSymbolConfiguration(_:) method to create a new image that contains the new attributes.

For design guidance, see Human Interface Guidelines.

Topics

Creating a Symbol Configuration

Applying a Configuration

Creating a Color Configuration

Type Methods

Initializers

See Also

Creating Symbol Images