ScreenSaverView is an abstract class that defines the interface for subclassers to interact with the screen saver infrastructure.
- macOS 10.0+
Screen savers are subclasses of
ScreenSaverView, 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.)
ScreenSaverView 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
draw(_:), or you can do your drawing in the
animateOneFrame(). If you do drawing in
draw(_:), you should call
setNeedsDisplay: with an argument of