SBSDKImageStoring

@protocol SBSDKImageStoring <NSObject, NSCopying>

Protocol for an order-aware (array like) image storage.

  • Number of images in the receiver.

    Declaration

    Objective-C

    @required
    @property (readonly, nonatomic) NSUInteger imageCount;

    Swift

    var imageCount: UInt { get }
  • Adds a UIImage into the storage.

    Declaration

    Objective-C

    - (BOOL)addImage:(nonnull UIImage *)image;

    Swift

    func add(_ image: UIImage) -> Bool

    Parameters

    image

    The image to be added. @returns YES, if the operation was successful, NO otherwise.

  • Adds an image from a file into the storage.

    Declaration

    Objective-C

    - (BOOL)addImageFromURL:(nonnull NSURL *)url;

    Swift

    func addImage(from url: URL) -> Bool

    Parameters

    url

    The file URL of the image to be added. @returns YES, if the operation was successful, NO otherwise.

  • Returns the stored UIImage at the specified index.

    Declaration

    Objective-C

    - (nullable UIImage *)imageAtIndex:(NSUInteger)index;

    Swift

    func image(at index: UInt) -> UIImage?

    Parameters

    index

    A valid index of the image. @returns The image at the given index, or nil if the image could not be loaded.

  • Returns the URL of the stored image at the specified index.

    Declaration

    Objective-C

    - (nullable NSURL *)imageURLAtIndex:(NSUInteger)index;

    Swift

    func imageURL(at index: UInt) -> URL?

    Parameters

    index

    A valid index of the image. @returns The images URL at the given index, or nil if the image file does not exist.

  • Removes the stored image at the given index from the image storage.

    Declaration

    Objective-C

    - (void)removeImageAtIndex:(NSUInteger)index;

    Swift

    func removeImage(at index: UInt)

    Parameters

    index

    A valid index of the image to be removed.

  • Removes all stored images from the image storage.

    Declaration

    Objective-C

    - (void)removeAllImages;

    Swift

    func removeAllImages()
  • Creates a deep copy of the image storage. @returns A copy of the storage.

    Declaration

    Objective-C

    - (nonnull id)copy;

    Swift

    func copy() -> Any