Skip to content

Instantly share code, notes, and snippets.

@ctrevarthen
Last active November 19, 2015 03:38
Show Gist options
  • Save ctrevarthen/27f926974beead37635b to your computer and use it in GitHub Desktop.
Save ctrevarthen/27f926974beead37635b to your computer and use it in GitHub Desktop.
ShopQuick - Favorites Manager DRY
class FavoritesManager : ProductManager {
static let sharedInstance = FavoritesManager()
override init() {
super.init()
self.productsKey = "com.detroitlabs.shopfast.favorites"
self.loadProductsFromDefaults()
}
func isProductFavorited(product: Product) -> Bool {
if let _ = self.findProductByName(product.name) {
return true
}
else {
return false
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment