Class

Screen​Saver​View

Screen​Saver​View is an abstract class that defines the interface for subclassers to interact with the screen saver infrastructure.

Overview

Screen savers are subclasses of Screen​Saver​View, packaged up in bundles and loaded by the screen saver application. (These bundles have a suffix of .saver and are located in the Library/Screen Savers directories of the various file system domains. See File System Overview for information about domains.) Screen​Saver​View defines an interface for animating screen savers, instantiating small preview versions of the screen saver view (for display in System Preferences, for example), and for providing a configuration sheet to set various properties of the screen saver. In addition, subclasses can set the animation interval, the backing store of their window, and how the screen transitions to the animation.

There are two main ways to do drawing in a screen saver. You can either do your drawing in the NSView method draw(_:​), or you can do your drawing in the Screen​Saver​View method animate​One​Frame(). If you do drawing in draw(_:​), you should call set​Needs​Display:​ with an argument of true in animate​One​Frame().

Symbols

Initializing a ScreenSaverView

init?(frame:​ NSRect, is​Preview:​ Bool)

Initializes a newly allocated Screen​Saver​View with frame as its frame rectangle, and sets the value returned by is​Preview to is​Preview.

Getting the preferred window behavior

class func backing​Store​Type()

Returns the desired backing store for windows in which the screen saver view will be instantiated.

class func perform​Gamma​Fade()

Indicates whether the screen saver application should perform a gradual screen fade when it starts and stops the animation.

Setting and getting the animation time interval

var animation​Time​Interval:​ Time​Interval

Sets the time interval between animation frames.

Animating the ScreenSaverView

func start​Animation()

Activates the periodic timer that animates the screen saver.

func animate​One​Frame()

Advances the screen saver’s animation by a single frame.

func stop​Animation()

Deactivates the timer that advances the animation.

var is​Animating:​ Bool

A Boolean value that indicates if the screen saver is currently animating.

Drawing the ScreenSaverView

func draw(NSRect)

Draws the screen saver view.

var is​Preview:​ Bool

A Boolean value that indicates if the screen saver view was created in a size appropriate for use as a preview.

Accessing the configuration sheet

func has​Configure​Sheet()

Returns whether the screen saver has an associated configuration sheet.

func configure​Sheet()

Returns the window containing all of the controls to be used for configuring the screen saver.