Class

NSAppearance

An object that manages standard appearance attributes for UI elements in an app.

Overview

Appearance information is stored in files. An app can contain multiple appearance files and—because NSAppearance conforms to NSCoding—you can use Interface Builder to assign UI elements to an appearance.

If the art for a specific view can’t be found, AppKit searches for the art in the appearances of the view’s ancestors. A nil appearance means that a view uses the default Aqua appearance; a non-nil appearance means that the view uses an ancestor’s appearance.

When AppKit draws a control, it automatically sets the current appearance on the current thread to the control’s appearance. The current appearance can influence the actual drawing path and the return values you get when you access system fonts and colors. The current appearance also affects the appearance of text and images, such as the text and template images that can be displayed in a toolbar.

Topics

Creating an Appearance

init?(appearanceNamed: NSAppearance.Name, bundle: Bundle?)

Creates an NSAppearance object initialized to the specified named appearance in the specified bundle.

Getting the Appearance Name

var name: NSAppearance.Name

The name of the appearance.

Getting an Appearance

init?(named: NSAppearance.Name)

Returns the NSAppearance object with the specified name.

Getting and Setting the Current Appearance

class var current: NSAppearance!

Returns the NSAppearance object that’s set on the current thread.

Managing Vibrancy

var allowsVibrancy: Bool

Specifies whether the current appearance allows vibrancy.

Constants

Standard Appearances

These strings are used to specify standard appearances provided by macOS.

Type Aliases

Relationships

Inherits From

See Also

Appearance Customization

protocol NSAppearanceCustomization

A set of methods for getting or setting the appearance attributes of a view.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software