Source: https://hackmd.io/@PN7C6hJWRlarnh710w4j-w/H1o_moSb5
Cookbook is an ios application which calls random recipes for the user to explore. You can refresh the recipes by using the refresh button which will update the tableview. You are able to find more information on the recipe like the summary, ingredients used and instructions on how to recreate the dish. If you like the recipe, click the heart to save in inside the favorites tab for the future. The project urtilizes the Spoonacular API for the data, Parse back4app to store favorite recipes and lottie animations.
Here's a walkthrough of implemented user stories:
video-of-app.mov
[Required]Download Xcode
- Open Terminal
- Change directory to where you want to clone the file
- Type
git clone https://github.com/Komal914/CookBook.git
- Open the cloned repository in Xcode and press CMD + R to run the app
OR download the zip file
Double click the file "Cookbook.xcodeproj" Press two keys simultaneously: CMD + R to run the app
-
Random Recipe Search
- 20 random recipes are called for the user to Browse
- Each recipe's photo and title are listed
- refesh button available to update the recipes
-
Recipe Details
- The recipe's summary, ingredients and instructions are provided
- By clicking the heart button, the button dings and the recipe has been saved
-
Favorites
- List of your favorite recipes with associated name and photo
-
Favorite Recipe Details
- Lists out the ingredients and instructions for the fav recipe
Tab Navigation (Tab to Screen)
- Random recipes
- Favorites
Flow Navigation (Screen to Screen)
- Random Recipes -> Recipe details
- Favorites -> favorite recipe's instructions
Property | Type | Description |
---|---|---|
Recipe name | String | The name of the recipe |
Recipe Image | String | The image URL associated with relevant recipe |
Recipe Description | String | Brief summary of the food |
Recipe Ingredients | String | Ingredients used for the recipe listed |
Recipe Instructions | String | List of instructions on how to prepare the dish |
- Random Recipes
- (Read/Get) Query random recipes from the Spoonacular API
//MARK:API Request
let request = URLRequest(url: RandomUrl, cachePolicy: .reloadIgnoringLocalCacheData, timeoutInterval: 10)
let session = URLSession(configuration: .default, delegate: nil, delegateQueue: OperationQueue.main)
let task = session.dataTask(with: request) { (data, response, error) in
// This will run when the network request returns
if let error = error {
print(error.localizedDescription)
} else if let data = data {
let dataDictionary = try! JSONSerialization.jsonObject(with: data, options: []) as! [String: Any]
self.recipeData = dataDictionary["recipes"] as! [[String: Any]] //api info downloaded
self.tableView.reloadData() //refresh data
}
}
After this data is loaded, once the user clicks on the recipe selected -> that recipe's details are segued onto the recipe details screen
- Favorites
- (Read/Get) Query all saved recipes of the user
let query = PFQuery(className:"FaveRecipes")
query.includeKey("title")
query.limit = 300
query.findObjectsInBackground{
(frecipes, error) in
if frecipes != nil{
self.frecipes = frecipes!
self.tableView.reloadData()
}
}
-
- (Delete) Users can delete a saved recipe
drecipe.deleteInBackground() { (success, error) in
if success{
print("deleted")
}
else{
print("not deleted ")
}
After this data is loaded, once the user clicks on the favorited recipe -> that recipe's details are segued onto the fav recipe details screen
- Setting tab for the user to update their diet prefrences to filter recipes inside search