Last active
November 19, 2015 03:38
-
-
Save ctrevarthen/27f926974beead37635b to your computer and use it in GitHub Desktop.
ShopQuick - Favorites Manager DRY
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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