Mac Developer Library

Developer

ScreenSaver Framework Reference Screen Saver Functions Reference

Options
Deployment Target:

On This Page
Language:

Screen Saver Functions Reference

Inheritance


Not Applicable

Conforms To


Not Applicable

Import Statement


Swift

import ScreenSaver

Objective-C

@import ScreenSaver;

This chapter describes functions and function-like macros available in the Screen Saver framework.

Several of the functions produce random values. These make use of the C random number generator, random(), which the screen saver framework will automatically seed.

Functions

  • This function returns a random integer value.

    Declaration

    Swift

    func SSRandomIntBetween(_ a: Int32, _ b: Int32) -> Int32

    Objective-C

    int SSRandomIntBetween ( int a, int b );

    Discussion

    Returns a random integer value between the values a and b, inclusive.

    Import Statement

    Objective-C

    @import ScreenSaver;

    Swift

    import ScreenSaver

    Availability

    Available in OS X v10.0 and later.

  • This function returns a random float value.

    Declaration

    Swift

    func SSRandomFloatBetween(_ a: CGFloat, _ b: CGFloat) -> CGFloat

    Objective-C

    CGFloat SSRandomFloatBetween ( CGFloat a, CGFloat b );

    Discussion

    Returns a random float value between the values a and b, inclusive.

    Import Statement

    Objective-C

    @import ScreenSaver;

    Swift

    import ScreenSaver

    Availability

    Available in OS X v10.0 and later.

  • This function returns a random point.

    Declaration

    Swift

    func SSRandomPointForSizeWithinRect(_ size: NSSize, _ rect: NSRect) -> NSPoint

    Objective-C

    NSPoint SSRandomPointForSizeWithinRect ( NSSize size, NSRect rect );

    Discussion

    Returns a random point within rect, constrained within (rect.size - size) from rect’s origin.

    Import Statement

    Objective-C

    @import ScreenSaver;

    Swift

    import ScreenSaver

    Availability

    Available in OS X v10.0 and later.

  • This function returns a rectangle.

    Declaration

    Swift

    func SSCenteredRectInRect(_ innerRect: NSRect, _ outerRect: NSRect) -> NSRect

    Objective-C

    NSRect SSCenteredRectInRect ( NSRect innerRect, NSRect outerRect );

    Discussion

    Returns a rectangle, based on centering innerRect within outerRect.

    Import Statement

    Objective-C

    @import ScreenSaver;

    Swift

    import ScreenSaver

    Availability

    Available in OS X v10.0 and later.