Favorites

public protocol Favorites

Actions available on a collection of Favorite instances. Supports subscribing to changes.

  • True if the collection of favorites has been restored from disk

    Declaration

    Swift

    var restored: Bool { get }
  • Get number of favorites

    Declaration

    Swift

    var count: Int { get }
  • Determine if the given favorite key is in the collection.

    Declaration

    Swift

    func contains(key: LegacyFavorite.Key) -> Bool

    Parameters

    key

    the key to look for

    Return Value

    true if it exists

  • Obtain the index of the given Favorite in the collection.

    Declaration

    Swift

    func index(of favorite: LegacyFavorite.Key) -> Int

    Parameters

    favorite

    what to look for

    Return Value

    the position of the Favorite

  • Obtain the Favorite at the given index

    Declaration

    Swift

    func getBy(index: Int) -> LegacyFavorite

    Parameters

    index

    the location to get

    Return Value

    Favorite at the index

  • Obtain the Favorite by its key.

    Declaration

    Swift

    func getBy(key: LegacyFavorite.Key) -> LegacyFavorite

    Return Value

    Favorite with the given key

  • Add a Favorite to the collection

    Declaration

    Swift

    func add(favorite: LegacyFavorite)

    Parameters

    favorite

    instance to add

  • Begin editing a Favorite

    Declaration

    Swift

    func beginEdit(config: FavoriteEditor.Config)

    Parameters

    config

    the configuration to apply to the editor

    view

    the UIView which started the editing

  • Update the collection due to a change in the given Favorite

    Declaration

    Swift

    func update(index: Int, config: PresetConfig)

    Parameters

    index

    the location where the Favorite should be

    config

    the latest config settings

  • Move a Favorite from one place in the collection to another.

    Declaration

    Swift

    func move(from: Int, to: Int)

    Parameters

    from

    where the Favorite is coming from

    to

    where the Favorite is moving to

  • Update the visibility of a favorite.

    Declaration

    Swift

    func setVisibility(key: LegacyFavorite.Key, state: Bool)

    Parameters

    key

    the key of the favorite to change

    state

    the visibility state to use

  • Set the effects configurations for a given favorite.

    • delay: the delay configuration to save
    • reverb: the reverb configuration to save

    Declaration

    Swift

    func setEffects(favorite: LegacyFavorite, delay: DelayConfig?, reverb: ReverbConfig?)

    Parameters

    favorite

    the favorite to update

  • The Favorite at the given index is selected by the user.

    Declaration

    Swift

    func selected(index: Int)

    Parameters

    index

    the index that is selected

  • Remove the Favorite at the given index.

    Declaration

    Swift

    func remove(key: LegacyFavorite.Key)

    Parameters

    index

    the index to remove

  • Remove all Favorite instances associated with the given SoundFont.

    Declaration

    Swift

    func removeAll(associatedWith: LegacySoundFont)

    Parameters

    associatedWith

    the SoundFont to look for

  • Obtain a count of the number of Favorite instances associated with the given SoundFont.

    Declaration

    Swift

    func count(associatedWith: LegacySoundFont) -> Int

    Parameters

    associatedWith

    what to look for

    Return Value

    count

  • Subscribe to notifications when the collection changes. The types of changes are defined in FavoritesEvent enum.

    Declaration

    Swift

    @discardableResult
    func subscribe<O: AnyObject>(_ subscriber: O, notifier: @escaping (FavoritesEvent) -> Void)
      -> SubscriberToken

    Parameters

    subscriber

    the object doing the monitoring

    notifier

    the closure to invoke when a change takes place

    Return Value

    token that can be used to unsubscribe

  • Undocumented

    Declaration

    Swift

    func validate(_ soundFonts: SoundFonts)