Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
...
// Recuperamos el estado actual de la sesión
self.isFavorite = DataManager.shared.existsFavoriteSesssion(named: session.title)
$isFavorite
// 1
.dropFirst()
// 2
.receive(on: RunLoop.main)
// 3
.sink(receiveValue: { (favorited: Bool) -> Void in
if favorited
{
DataManager.shared.insertFavoriteSession(named: session.title, backdrop: session.imageURL)
}
else
{
DataManager.shared.deleteFavoriteSession(named: session.title)
}
})
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.