Hi everyone!
I'm making a food app where the user can save meals to categories, and add an image, ingredients, and the recipe.
The meal name is saved to a UserDefaults array. Then, a dictionary is created with the meal name, ingredients, recipe, and the image location path on the device - and saved.
For example:
(I'm only using block comments for each comment here as the Developer Forums don't seem to support "//")
I need a way to display all of this on my app's home screen. Ideally, I'd like a side-scrolling collection view with the images that users upload, and the meal title displayed on them. (The last bit is easy enough, just a blur effect and a label)
If that's not possible, a TableView that shows all of the meals in a separate cell - and segues to a view with the meal name and associated info - would work for now.
I'm relatively new to Swift so I apologise if I'm doing anything wrong here — thanks so much to everyone in advance.
I look forward to your responses and I hope everyone is doing well during this time!
I'm making a food app where the user can save meals to categories, and add an image, ingredients, and the recipe.
The meal name is saved to a UserDefaults array. Then, a dictionary is created with the meal name, ingredients, recipe, and the image location path on the device - and saved.
For example:
Code Block /*Save the new meal to the array*/ self.breakfasts.append(newMealName!) /*Update UserDefaults with the new array*/ self.defaults.set(self.breakfasts, forKey: "breakfasts") /*Define the dictionary*/ let dict = ["Name": newMealName, "Ingredients": newMealIngred, "Recipe": newMealRecipe, "Type": "breakfasts", "Image": imgPath] /*Save the dictionary to UserDefaults*/ self.defaults.set(dict, forKey: newMealName!)
(I'm only using block comments for each comment here as the Developer Forums don't seem to support "//")
I need a way to display all of this on my app's home screen. Ideally, I'd like a side-scrolling collection view with the images that users upload, and the meal title displayed on them. (The last bit is easy enough, just a blur effect and a label)
If that's not possible, a TableView that shows all of the meals in a separate cell - and segues to a view with the meal name and associated info - would work for now.
I'm relatively new to Swift so I apologise if I'm doing anything wrong here — thanks so much to everyone in advance.
I look forward to your responses and I hope everyone is doing well during this time!