Declared in SPNSExtensions.h

Overview

Sparrow extensions for the NSBundle class.

Tasks

  • – pathForResource:

    Finds the path for a resource. ‘name’ may include directories and the file extension.

  • – pathForResource:withScaleFactor:

    Finds the path for a resource with a certain scale factor (a file with a suffix like ‘@2x’).

  • + appBundle

    Returns the NSBundle object of the current application. Different to [NSBundle mainBundle], this works in unit tests, as well.

Class Methods

appBundle

Returns the NSBundle object of the current application. Different to [NSBundle mainBundle], this works in unit tests, as well.

+ (instancetype)appBundle

Discussion

Returns the NSBundle object of the current application. Different to [NSBundle mainBundle], this works in unit tests, as well.

Declared In

SPNSExtensions.h

Instance Methods

pathForResource:

Finds the path for a resource. ‘name’ may include directories and the file extension.

- (NSString *)pathForResource:(NSString *)name

Discussion

Finds the path for a resource. ‘name’ may include directories and the file extension.

Declared In

SPNSExtensions.h

pathForResource:withScaleFactor:

Finds the path for a resource with a certain scale factor (a file with a suffix like ‘@2x’).

- (NSString *)pathForResource:(NSString *)name withScaleFactor:(float)factor

Return Value

Returns the path to the scaled resource if it exists; otherwise, the path to the unscaled resource - or nil if that does not exist, either.

Discussion

Finds the path for a resource with a certain scale factor (a file with a suffix like ‘@2x’).

Declared In

SPNSExtensions.h