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) -> BoolParameters
keythe 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) -> IntParameters
favoritewhat to look for
Return Value
the position of the Favorite
-
Obtain the Favorite at the given index
Declaration
Swift
func getBy(index: Int) -> LegacyFavoriteParameters
indexthe location to get
Return Value
Favorite at the index
-
Obtain the Favorite by its key.
Declaration
Swift
func getBy(key: LegacyFavorite.Key) -> LegacyFavoriteReturn Value
Favorite with the given key
-
Add a Favorite to the collection
Declaration
Swift
func add(favorite: LegacyFavorite)Parameters
favoriteinstance to add
-
Begin editing a Favorite
Declaration
Swift
func beginEdit(config: FavoriteEditor.Config)Parameters
configthe configuration to apply to the editor
viewthe 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
indexthe location where the Favorite should be
configthe latest config settings
-
Move a Favorite from one place in the collection to another.
Declaration
Swift
func move(from: Int, to: Int)Parameters
fromwhere the Favorite is coming from
towhere the Favorite is moving to
-
Update the visibility of a favorite.
Declaration
Swift
func setVisibility(key: LegacyFavorite.Key, state: Bool)Parameters
keythe key of the favorite to change
statethe 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
favoritethe favorite to update
-
The Favorite at the given index is selected by the user.
Declaration
Swift
func selected(index: Int)Parameters
indexthe index that is selected
-
Remove the Favorite at the given index.
Declaration
Swift
func remove(key: LegacyFavorite.Key)Parameters
indexthe index to remove
-
Remove all Favorite instances associated with the given SoundFont.
Declaration
Swift
func removeAll(associatedWith: LegacySoundFont)Parameters
associatedWiththe SoundFont to look for
-
Obtain a count of the number of Favorite instances associated with the given SoundFont.
Declaration
Swift
func count(associatedWith: LegacySoundFont) -> IntParameters
associatedWithwhat 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) -> SubscriberTokenParameters
subscriberthe object doing the monitoring
notifierthe closure to invoke when a change takes place
Return Value
token that can be used to unsubscribe
-
Undocumented
Declaration
Swift
func validate(_ soundFonts: SoundFonts)
View on GitHub
Favorites Protocol Reference