Last active
November 19, 2015 03:37
-
-
Save ctrevarthen/394b1f44cb7eb26f575c to your computer and use it in GitHub Desktop.
ShopQuick - Favorites Manager - Is Favorited?
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
func isProductFavorited(product: Product) -> Bool { | |
if let _ = self.findProductByName(product.name) { | |
return true | |
} | |
else { | |
return false | |
} | |
} | |
func findProductByName(name: String) -> Product? { | |
let results = self.products.filter { (found: Product) -> Bool in | |
if found.name == name { | |
return true | |
} | |
return false | |
} | |
return results.first | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment