Inherits from NSObject
Declared in SPUtils.h

Overview

The SPUtils class contains utility methods for different purposes.

Tasks

Math Utils

File Utils

  • + fileExistsAtPath:

    Returns a Boolean value that indicates whether a file or directory exists at a specified path. If you pass a relative path, the resource folder of the application bundle will be searched.

  • + absolutePathToFile:withScaleFactor:idiom:

    Finds the full path for a file, favoring those with the given scale factor and device idiom. Relative paths are searched in the application bundle. If no suitable file can be found, the method returns nil.

  • + absolutePathToFile:withScaleFactor:

    Finds the full path for a file, favoring those with the given scale factor and the current device idiom. Relative paths are searched in the application bundle. If no suitable file can be found, the method returns nil.

  • + absolutePathToFile:

    Finds the full path for a file, favoring those with the current content scale factor and device idiom. Relative paths are searched in the application bundle. If no suitable file can be found, the method returns nil.

Class Methods

absolutePathToFile:

Finds the full path for a file, favoring those with the current content scale factor and device idiom. Relative paths are searched in the application bundle. If no suitable file can be found, the method returns nil.

+ (NSString *)absolutePathToFile:(NSString *)path

Discussion

Finds the full path for a file, favoring those with the current content scale factor and device idiom. Relative paths are searched in the application bundle. If no suitable file can be found, the method returns nil.

Declared In

SPUtils.h

absolutePathToFile:withScaleFactor:

Finds the full path for a file, favoring those with the given scale factor and the current device idiom. Relative paths are searched in the application bundle. If no suitable file can be found, the method returns nil.

+ (NSString *)absolutePathToFile:(NSString *)path withScaleFactor:(float)factor

Discussion

Finds the full path for a file, favoring those with the given scale factor and the current device idiom. Relative paths are searched in the application bundle. If no suitable file can be found, the method returns nil.

Declared In

SPUtils.h

absolutePathToFile:withScaleFactor:idiom:

Finds the full path for a file, favoring those with the given scale factor and device idiom. Relative paths are searched in the application bundle. If no suitable file can be found, the method returns nil.

+ (NSString *)absolutePathToFile:(NSString *)path withScaleFactor:(float)factor idiom:(UIUserInterfaceIdiom)idiom

Discussion

Finds the full path for a file, favoring those with the given scale factor and device idiom. Relative paths are searched in the application bundle. If no suitable file can be found, the method returns nil.

Declared In

SPUtils.h

fileExistsAtPath:

Returns a Boolean value that indicates whether a file or directory exists at a specified path. If you pass a relative path, the resource folder of the application bundle will be searched.

+ (BOOL)fileExistsAtPath:(NSString *)path

Discussion

Returns a Boolean value that indicates whether a file or directory exists at a specified path. If you pass a relative path, the resource folder of the application bundle will be searched.

Declared In

SPUtils.h

isPowerOfTwo:

Checks if a number is a power of two.

+ (BOOL)isPowerOfTwo:(int)number

Discussion

Checks if a number is a power of two.

Declared In

SPUtils.h

nextPowerOfTwo:

Finds the next power of two equal to or above the specified number.

+ (int)nextPowerOfTwo:(int)number

Discussion

Finds the next power of two equal to or above the specified number.

Declared In

SPUtils.h

randomFloat

Returns a random float number between 0.0 and 1.0

+ (float)randomFloat

Discussion

Returns a random float number between 0.0 and 1.0

Declared In

SPUtils.h

randomFloatBetweenMin:andMax:

Returns a random float number between minValue (inclusive) and maxValue (exclusive).

+ (float)randomFloatBetweenMin:(float)minValue andMax:(float)maxValue

Discussion

Returns a random float number between minValue (inclusive) and maxValue (exclusive).

Declared In

SPUtils.h

randomIntBetweenMin:andMax:

Returns a random integer number between minValue (inclusive) and maxValue (exclusive).

+ (int)randomIntBetweenMin:(int)minValue andMax:(int)maxValue

Discussion

Returns a random integer number between minValue (inclusive) and maxValue (exclusive).

Declared In

SPUtils.h