GSMediaStore

@objc(GSMediaStore)
public protocol GSMediaStore : Peripheral

Objective-C version of MediaStore.

Note

This class is for Objective-C only and must not be used in Swift.
  • Current indexing state of the media store.

    Declaration

    Swift

    var indexingState: MediaStoreIndexingState { get }
  • Total number of photo medias in the media store.

    Declaration

    Swift

    var photoMediaCount: Int { get }
  • Total number of video medias in the media store.

    Declaration

    Swift

    var videoMediaCount: Int { get }
  • Total number of photo resources in the media store.

    Declaration

    Swift

    var photoResourceCount: Int { get }
  • Total number of video resources in the media store.

    Declaration

    Swift

    var videoResourceCount: Int { get }
  • Creates a new Media list.

    This function starts loading the media store content, and notifies when it has been loaded and each time the content changes.

    Note

    This function is for Objective-C only.

    Declaration

    Swift

    @objc(newList:)
    func newListRef(observer: @escaping (_ medias: [MediaItem]?) -> Void) -> GSMediaListRef

    Parameters

    observer

    observer which gets notified when the media list loads or changes

    medias

    list media, nil if the store has been removed

    Return Value

    a reference on a list of MediaItem. Caller must keep this instance referenced for the observer to be called.

  • Creates a new Media list for a specific storage.

    This function starts loading the media store content on a specific storage, and notifies when it has been loaded and each time the content changes.

    Note

    if storage is nil, MediaItems in any storage are returned in the list.

    Note

    This function is for Objective-C only.

    Declaration

    Swift

    @objc(newList:storage:)
    func newListRef(storage: StorageType,
                    observer: @escaping (_ medias: [MediaItem]?) -> Void) -> GSMediaListRef

    Parameters

    storage

    storage type on which the Media list will be created

    observer

    observer which gets notified when the media list loads or changes

    medias

    list media, nil if the store has been removed

    Return Value

    a reference on a list of MediaItem. Caller must keep this instance referenced for the observer to be called.

  • Creates a new media thumbnail downloader.

    Note

    Typical usage in a UITableView is to call newMediaThumbnailDownloader() in UITableViewDataSource.(tableView:cellForRowAt:) and store the returned Ref<UIImage> inside the UITableViewCell. Then in the UITableViewCell.prepareForReuse() function set the stored Ref<UIImage> to nil to cancel the download request.

    Note

    This function is for Objective-C only.

    Declaration

    Swift

    @objc(newThumbnailDownloaderForMedia:observer:)
    func newThumbnailDownloaderRef(media: MediaItem, observer: @escaping (_ thumbnail: UIImage?) -> Void)
        -> GSMediaImageRef

    Parameters

    media

    media item to download the thumbnail from

    observer

    observer called when the thumbnail has been downloaded. Observer is called immediately if the thumbnail is already cached

    thumbnail

    loaded or cached thumbnail, nil if the thumbnail can’t be downloaded

    Return Value

    A reference of the media downloader. Caller must keep this instance referenced for the observer to be called.

  • Creates a new media resource downloader.

    Note

    If full type is selected (default), signatures will also be downloaded. If preview type is selected, no signature will be downloaded and videos will be ignored.

    Note

    This function is for Objective-C only.

    Declaration

    Swift

    @objc(newDownloaderForMediaResources:destination:observer:)
    func newDownloaderRef(mediaResources: MediaResourceList, destination: GSDownloadDestination,
                          observer: @escaping (_ downloader: MediaDownloader?) -> Void) -> GSMediaDownloaderRef

    Parameters

    mediaResources

    list of media resources to download

    destination

    download destination

    observer

    observer called when the MediaDownloader changes, indicating download progress

    Return Value

    a reference on a GSMediaDownloaderRef. Caller must keep this instance referenced until all media are downloaded. Setting it to nil cancels the download.

  • Creates a new Media deleter, to delete a list of media.

    Note

    This function is for Objective-C only.

    Declaration

    Swift

    @objc(newDeleterForMedia:observer:)
    func newDeleterRef(medias: [MediaItem], observer: @escaping (_ deleter: MediaDeleter?) -> Void)
        -> GSMediaDeleterRef

    Parameters

    medias

    list of media to delete

    observer

    observer called with MediaDeleter changes, indicating progress of the delete task. Referenced media deleter is nil if the delete task was interrupted.

    deleter

    deleter storing the delete progress info

    Return Value

    a reference on a GSMediaDeleterRef. Caller must keep this instance referenced until all media are deleted. Setting it to nil cancels the delete.

  • Creates a new media deleter to delete all medias.

    Note

    This function is for Objective-C only.

    Declaration

    Swift

    @objc(newAllMediasDeleterWithObserver:)
    func newAllMediasDeleterRef(observer: @escaping (_ deleter: AllMediasDeleter?) -> Void) -> GSAllMediasDeleterRef

    Parameters

    observer

    observer called when AllMediasDeleter changes, indicating progress of the delete task. Referenced media deleter is nil if the delete task was interrupted.

    deleter

    deleter storing the delete progress info

    Return Value

    a reference on a AllMediaDeleter. Caller must keep this instance referenced until all media are deleted. Setting it to nil cancels the delete.