BPKIcon

@interface BPKIcon : NSObject

This class encapsulates all Backpack icons and the ability to render them as UIImage. It leverages a NSCache to prevent excessive performance impact when using the same icon many times. Further the use of NSCache means that in low memory scenarios the cache will be cleared to allow more important memory use.

  • A dictionary mapping icon names to the unicode code point in the icon font of the icon.

    Declaration

    Objective-C

    @property (class, nonatomic, readonly, nullable) NSDictionary<BPKIconName, NSString *> *iconMapping;

    Swift

    class var iconMapping: [BPKIconName : String]? { get }
  • The concrete point size for a small icon.

    Declaration

    Objective-C

    @property (class, readonly) CGSize concreteSizeForSmallIcon;

    Swift

    class var concreteSizeForSmallIcon: Size { get }
  • The concrete point size for a large icon.

    Declaration

    Objective-C

    @property (class, readonly) CGSize concreteSizeForLargeIcon;

    Swift

    class var concreteSizeForLargeIcon: Size { get }
  • The concrete point size for a extra-large icon.

    Declaration

    Objective-C

    @property (class, readonly) CGSize concreteSizeForXlIcon;

    Swift

    class var concreteSizeForXlIcon: Size { get }
  • DEPRECATED. USE smallTemplateIconNamed:..., OR largeTemplateIconNamed:... INSTEAD Render a given icon as a UIImage for use as a template, i.e. with renderMode set to UIImageRenderingModeAlwaysTemplate.

    Declaration

    Objective-C

    + (nonnull UIImage *)templateIconNamed:(nonnull BPKIconName)name
                                      size:(BPKIconSize)size;

    Swift

    class func makeTemplateIcon(name: BPKIconName, size: BPKIconSize) -> UIImage

    Parameters

    name

    The name of the icon e.g. “flight”.

    size

    The size to render the icon in.

    Return Value

    The rendered icon as a UIImage in template mode.

  • DEPRECATED. USE smallIconNamed:..., OR largeIconNamed:... INSTEAD Render a given icon as a UIImage.

    Declaration

    Objective-C

    + (nonnull UIImage *)iconNamed:(nonnull BPKIconName)name
                             color:(nonnull UIColor *)color
                              size:(BPKIconSize)size;

    Swift

    class func makeIcon(name: BPKIconName, color: Any!, size: BPKIconSize) -> UIImage

    Parameters

    name

    The name of the icon e.g. “flight”.

    color

    The color to render the icon in.

    size

    The size to render the icon in.

    Return Value

    The rendered icon as a UIImage.

  • Calculates the concrete point size a given BPKIconSize.

    Declaration

    Objective-C

    + (CGSize)concreteSizeForIconSize:(BPKIconSize)size;

    Swift

    class func concreteSize(forSize size: BPKIconSize) -> Any!

    Parameters

    size

    The size for which to calculate the concrete size.

    Return Value

    The concerete point size for the given size.

  • Render a given small icon as a UIImage for use as a template, i.e. with renderMode set to UIImageRenderingModeAlwaysTemplate.

    Declaration

    Objective-C

    + (nonnull UIImage *)smallTemplateIconNamed:(nonnull BPKSmallIconName)name;

    Swift

    class func makeSmallTemplateIcon(name: BPKSmallIconName) -> UIImage

    Parameters

    name

    The name of the icon e.g. “flight”.

    Return Value

    The rendered icon as a UIImage in template mode.

  • Render a given large icon as a UIImage for use as a template, i.e. with renderMode set to UIImageRenderingModeAlwaysTemplate.

    Declaration

    Objective-C

    + (nonnull UIImage *)largeTemplateIconNamed:(nonnull BPKLargeIconName)name;

    Swift

    class func makeLargeTemplateIcon(name: BPKLargeIconName) -> UIImage

    Parameters

    name

    The name of the icon e.g. “flight”.

    Return Value

    The rendered icon as a UIImage in template mode.

  • Render a given extra-large icon as a UIImage for use as a template, i.e. with renderMode set to UIImageRenderingModeAlwaysTemplate.

    Declaration

    Objective-C

    + (nonnull UIImage *)xlTemplateIconNamed:(nonnull BPKXlIconName)name;

    Swift

    class func makeXlTemplateIcon(name: BPKXlIconName) -> UIImage

    Parameters

    name

    The name of the icon e.g. “flight”.

    Return Value

    The rendered icon as a UIImage in template mode.

  • Render a given small icon as a UIImage.

    Declaration

    Objective-C

    + (nonnull UIImage *)smallIconNamed:(nonnull BPKSmallIconName)name
                                  color:(nonnull UIColor *)color;

    Swift

    class func makeSmallIcon(name: BPKSmallIconName, color: Any!) -> UIImage

    Parameters

    name

    The name of the icon e.g. “flight”.

    color

    The color to render the icon in.

    Return Value

    The rendered icon as a UIImage.

  • Render a given large icon as a UIImage.

    Declaration

    Objective-C

    + (nonnull UIImage *)largeIconNamed:(nonnull BPKLargeIconName)name
                                  color:(nonnull UIColor *)color;

    Swift

    class func makeLargeIcon(name: BPKLargeIconName, color: Any!) -> UIImage

    Parameters

    name

    The name of the icon e.g. “flight”.

    color

    The color to render the icon in.

    Return Value

    The rendered icon as a UIImage.

  • Render a given small icon as a UIImage.

    Declaration

    Objective-C

    + (nonnull UIImage *)xlIconNamed:(nonnull BPKXlIconName)name
                               color:(nonnull UIColor *)color;

    Swift

    class func makeXlIcon(name: BPKXlIconName, color: Any!) -> UIImage

    Parameters

    name

    The name of the icon e.g. “flight”.

    color

    The color to render the icon in.

    Return Value

    The rendered icon as a UIImage.