CS计算机代考程序代写 database Hive IOS Purpose:

Purpose:
Assignment 2: iOS Portfolio Exercises
Due Date: Friday Week 6 (11:55PM) – Weight: 30% Interview Date: Scheduled Week 7 Lab Class
The purpose of this assessment is to evaluate your understanding of the fundamentals of iOS programming taught over Weeks 1–5, and your ability to apply them in practice to produce an iOS application based on a provided specification.
Completion of this assessment demonstrates the following learning outcomes:
– Analyse mobile interface guidelines and technical constraints to design effective
navigation and user interfaces for mobile apps
– Apply common object-oriented design patterns such as Model-View-Controller and
Delegation
– Follow iOS best practices to design, construct and test non-trivial iOS apps with a web
service component
Task:
For this assignment, you will complete a set of portfolio tasks to create an application for storing recipes for a set of favourite meals. This application will store a list of meals, either fetched from an online API or entered by the user.
The application will support the following features (described in more detail below): – A “My Meals” screen that shows a list of all meals stored by the user
– A “Search Meals” screen for querying a web API for meals based on a name – A “Create/Display Meal” screen for showing and editing the details of a Meal – An “Edit Name” screen for setting the name of a meal
– An “Edit Instructions” screen for setting the instructions for making a meal
– An “Add Ingredient” screen for adding a new ingredient and quantity to a meal recipe – An “Ingredient Detail” screen for showing a description of an ingredient
The assessment is composed of four cumulative portfolio tasks, based on the content covered in the first 5 weeks of semester. Note: you submit just one version of the code: the final completed app after Exercise 4. The instructions are arranged as exercises to mirror lab work and allow you to work on them progressively as you complete relevant labs.
Warning: You should start working on this assignment immediately. This is not an assignment that can be completed in the last week!
1

The specific exercises and expectations for each part are included below. Note, the application MUST adhere to the Apple Human Interface Guidelines and correctly support Dark Mode and Dynamic Type.
Exercise 1 – Build Application Shell (20%)
For this exercise you will begin working on the application by creating the application shell. As part of this activity the application shell is to be built, including the screens and segues.
Part 1: Implement Data Classes (Meal, Ingredient and IngredientMeasurement)
You are required to develop a set of classes to represent a Meal, an Ingredient and an Ingredient + Measurement. The classes should have the following properties.
Meal class:
– name – String
– instructions – String
– ingredients – list of IngredientMeasurement class instances
IngredientMeasurement class: – name – String
– quantity – String
Ingredient class:
– name – String
– description – String
If you choose, you may elect to include additional properties based on what is available from the APIs (See Task 4).
Part 2: Create “My Meals” screen
This will be the initial screen seen by the users when opening the application. It should be a Table View Controller, where each row is a saved Meal.
This screen should have a button to add new recipes (via search functionality in Exercise 4). Tapping it should trigger a segue to the “Search Meals” screen.
Tapping on a recipe row in the table should trigger a segue taking the user to the “Create / Edit Meal” screen (for displaying details of the saved meal).
Exercise 2 describes the setup of the Table View Cells.
2

Part 3: Create “Search Meals” screen
Create a second Table View Controller for searching new meals (which will come from a Web API in Task 4).
This should display two cell types. Meal cells and an Info cell. Selecting the Meal cell will store the meal. Tapping the Info cell should segue to the “Create / Edit Meal” screen (for entering a new meal). You are not required to implement the logic or the code yet.
Part 4: Create “Create / Edit Meal” screen
You are to create a Table View Controller for displaying and changing the details of a given meal. This screen serves a dual purpose.
● This screen will be used to display and edit existing meals within the application when coming from the “My Meals” screen of the app.
● This screen will also be used to create new meal recipes, after a search has failed to yield a desired recipe.
This view controller will require segues to the “Edit Name”, “Edit Instructions” and “Add Ingredient Measurement” screens, triggered by tapping on different cells. You can create these as manual segues now or set them up in the next exercise when you create the cells.
Part 5: Create “Edit Name” screen
Create a new View Controller for entering / editing a meal’s name. You are free to design this screen as long as it provides:
– The ability to enter/edit a name – A button for saving changes
The action for saving changes should include sensible validation for the name (i.e., cannot be empty) and display errors to the user. If valid, it should notify the “Create/Display Meal” View Controller of the change via delegation.
Part 6: Create “Edit Instructions” screen
Create a new View Controller for entering / editing a meal’s instructions. You are free to design this screen as it provides:
– The ability to add/edit instruction text (a multi-line string, see UITextView) – A button for saving changes
The action for saving changes should include sensible validation for the instructions (i.e., cannot be empty) and display errors to the user. If valid, it should notify the “Create/Display Meal” View Controller of the change via delegation.
3

Part 7: Create “Add Ingredient” screen
Create a View Controller for entering an ingredient and measurement amount. You are free to design this screen as you see fit as long as it provides:
– The ability to select one ingredient from a list of all ingredients that exist within the application.
– For Ingredients that have information, the ability to segue to the Ingredient Information screen to view that information.
– The ability to enter a measurement amount. There is no strict rule for what kinds of measurements are allowed. This is just a descriptive string.
– A button for saving changes
Initially, for Tasks 1 and 2 you should hardcode ingredients into the screen for testing purposes. Task 3 will transition to use Core Data to store ingredients, with Task 4 populating the information from a Web API.
The action for saving changes should include sensible validation (i.e., there must be an ingredient, and the measurement cannot be empty) and display errors to the user. If valid, it should notify the “Create/Display Meal” View Controller of the new Ingredient Measurement via delegation.
Part 8: Create “Ingredient Detail” screen
The Ingredient Detail screen will need to display a text description of an ingredient (a string of unknown length that may include line breaks) and should display the title of the Ingredient.
Exercise 2 – Implementing table views and application logic (20%)
For this exercise you will implement most of the functionality of the various screens.
Part 1: Implement the My Meals screen
For this task you are required to fully implement the My Meals screen. This screen should display a list of saved meals. This screen should be the first screen users see upon launching the application.
For this task, consider using hard coded variables for testing purposes. Task 3 will re-visit this screen and implement Core Data.
The cells in this table view should display the meal name, and some short descriptive information (e.g., ingredients or the beginning of instructions). The cell design is left up to you. An example is shown below:
4

A total number of saved meals should be displayed as well. If there are no saved meals, an instruction on how to add some should be shown.
Tapping on a meal should take the user to the “Create/Edit Meal” screen with all fields pre-filled with the meal information.
The user should have the ability to delete saved meals, updating the saved meal count.
5

Part 2: Implement the Search Meals screen
For this task you are required to partially implement the “Search Meals” Screen. The screen must display a search bar that allows the user to enter a partial meal name to look for. This search will utilise a Web API (to be completed in Exercise 4).
The table view need not display anything until the user performs a search.
If there are meals found matching the search, a table view cell should be displayed for each. Tapping a meal should add it to the user’s stored meals and return to the “My Meals” screen.
The search functionality need not be completed until the later step. For now, you may wish to hard code a couple of meals as dummy “search results” regardless of the search term.
When the user performs a search, regardless of whether matches are found, the table view should display a row inviting the user to create a new meal. Tapping this should take the user to the “Create/Edit Meal” screen (in create mode).
Again, you are free to design the screen. Consider Apple Design Guidelines and what would be best for the user experience. An example is shown below, but yours need not match.
Initial Entry Found Results No Results
6

Part 3: Implement the Create/Display Meal screen
This screen must include a table view with sections to display details of a meal. It should show the meal name, instructions, a list of ingredients and the option to add additional ingredients. The ingredient cells must be implemented using custom table view cells. An example of what this may look like is provided below, but yours need not look identical.
If this screen is being used to show details of an existing meal, the details for the meal should be pre-filled. The title shown in the navigation bar should also be set appropriately.
If being used to enter a new meal, then it should contain no pre-filled information.
The user should have the ability to delete ingredient cells but not delete other cells. Deleting an ingredient cell should remove the ingredient measurement from the meal.
Tapping the name cell should take the user to the Edit Name screen with the current name. Tapping the instruction cell should take the user to the Edit Instructions screen with the current instructions.
Ingredient cells should not be selectable.
Tapping the “Add Ingredient” cell should take the user to the Add Ingredient screen.
Tapping the Save button should send the user back to the main My Meals screen:
● If the user was creating a new meal, this should be saved to the My Meals list.
● If the user was modifying a meal, any changes they made should be saved.
7

Part 4: Implement the Edit Name and Edit Instructions screens
These screens should each allow the user to enter or edit an existing name or instructions and give the user the option to save. Save changes should be reported back via delegation.
Part 5: Implement the Add Ingredient screen
We suggest that one suitable design for this screen would be a tableview showing cells for each Ingredient, with detail accessory buttons to view information. When the user selects an Ingredient, a UIAlertController can be used to enter a measurement (see the UIAlertController addTextField method and textFields property documentation).
Part 5: Implement the Ingredient Detail screen
The Ingredient Detail screen will just show a textview with the information on the Ingredient and the Ingredient name in the title bar.
8

Exercise 3 – Implementing Core Data (40%)
Create a persistent database to store all available ingredients and the user’s saved meals including their ingredient measurements. Previously you made use of dummy data for testing purposes and all saved meals did not persist between application runs. For data persistence you will use the Core Data framework.
Part 1: Create Core Data Meal class
Create a Meal entity and associated class using Core Data. The information it requires is the same as in Exercise 1. It should have a one-to-many “ingredients” relationship with the IngredientMeasurement entity.
Part 2: Create Core Data Ingredient class
Create an Ingredient entity and associated class using Core Data. The information it requires is the same as in Exercise 1.
Part 3: Create Core Data IngredientMeasurement class
Create an IngredientMeasurement entity and associated class using Core Data. The information it requires is the same as in Exercise 1. It should have a many-to-one relationship with the Meal entity.
Part 4: Write the Database Controller
Create a Database Controller class to encapsulate all communications between the Application and its underlying Core Data database. You should follow the design paradigm demonstrated in the labs.
At a –
– –
– – – – – –

minimum, this should contain methods for the following:
Create and return a new Meal object.
Add a new IngredientMeasurement to a Meal, given the meal, ingredient name and a measurement.
Remove an IngredientMeasurement from a Meal, given the meal and ingredient measurement.
Fetch all Meals (using a fetched results controller) for the My Meals screen.
Fetch all Ingredients (using a fetched results controller) for the Add Ingredient screen. Create a list of default ingredients upon first launch (to be changed in Exercise 4).
Save changes
Add and remove listeners for the fetched results controller
Passed an optional Meal (i.e., Meal or Nil), return a Meal in child managed object context. If passed a Meal, the returned meal should be a copy in the child content. If not passed a Meal, the returned Meal should be a new empty Meal in the child context. Save changes to the child managed object context.
9

Part 5: My Meals screen
Update the My Meals screen so that it shows all meals currently stored within Core Data. You should also remove the default list used in Exercise 2.
Part 6: Update Create/Display Meal screen
Update the Create/Display Meal screen to use Core Data, and specifically for updating / changing the meal. This means the user can make changes such as adding an ingredient, and these will be made in the child context, but only persisted if the user taps Save.
We suggest that this screen operate on a Meal object in a child managed object context. See suggested Core Data Controller method above.
Remember that managed objects can’t be shared between contexts, so if you are adding Ingredient Measurements to the Meal, ensure they are created in the same context (hint: everyNSManagedObject has a context property for the context it is in).
When the user swipes to delete an Ingredient Measurement it should be removed from the meal.
When the Save button is tapped, any changes to the meal should be pushed to the main context and saved.
If the user taps the Back button, no changes that have been made to the meal through this screen should be persisted.
Part 7: Add Ingredient Measurement screen
For this task you must update the Add Ingredient Measurement screen so that shown ingredients are loaded from Core Data.
Tapping Save should create an Ingredient Measurement and add it to the meal.
10

Exercise 4 – Utilising a web service (20%)
For this exercise you will communicate with an online meal API to get a list of possible meal ingredients and search pre-existing meals. This exercise will complete the development of the app.
The web service we are using is TheMealDB API. Information on the full API features can be found at https://www.themealdb.com/api.php
Part 1: Setup Ingredients to load once upon initial launch
You are required to make a call to the API to load in all known ingredients and store them within Core Data. This will be the source of the Ingredient list displayed when adding an ingredient to a meal.
This should be done when the application launches and only if there are no ingredients within Core Data already (i.e., only on the first launch). Ensure that all dummy ingredients are removed from the code prior to this.
A child managed context must be used when saving the Ingredients to Core Data to ensure that all are saved, or none.
The following URL returns a JSON Object with an array of all available ingredients.
https://www.themealdb.com/api/json/v1/1/list.php?i=list
Warning: Whilst this exercise may appear shorter than others, the steps involved are quite time consuming. DO NOT leave this until the last minute.
{
“meals”: [
{
“idIngredient”: “1”,
“strIngredient”: “Chicken”,
“strDescription”: “The chicken is a type of domesticated fowl “strType”: null
}, {
of ray-finned fish in the family Salmonidae. “, “strType”: null
}] }
“idIngredient”: “2”,
“strIngredient”: “Salmon”,
“strDescription”: “Salmon is the common name for several species
11

Note: the value of the “strDescription” field should be used for your Ingredient class’ “information” property (NSManagedObjects already have a “description” property, so we use “information” for the Core Data property name).
Part 2: Update Search Meal Screen
You are required to update the Search Meal screen so that when a search term is entered, it queries the API for all meals with a name matching the search term.
The user should be provided some indication that the search is in progress and then shown results once the request completes.
The following link returns a JSON Object with an array of meals matching the search term “Arrabiata”:. https://www.themealdb.com/api/json/v1/1/search.php?s=Arrabiata
{
“meals”: [
{
“idMeal”: “52771”,
“strMeal”: “Spicy Arrabiata Penne”,
“strDrinkAlternate”: null,
“strCategory”: “Vegetarian”,
“strArea”: “Italian”,
“strInstructions”: “Bring a large pot of water to a boil. Add kosher salt to the boiling
water, then add the pasta. Cook according to the package instructions, about 9 minutes.\r\nIn a large skillet over medium-high heat, add the olive oil and heat until the oil starts to shimmer. Add the garlic and cook, stirring, until fragrant, 1 to 2 minutes. Add the chopped tomatoes, red chile flakes, Italian seasoning and salt and pepper to taste. Bring to a boil and cook for 5 minutes. Remove from the heat and add the chopped basil.\r\nDrain the pasta and add
it to
the sauce. Garnish with Parmigiano-Reggiano flakes and more basil and serve warm.”, “strMealThumb”: “https://www.themealdb.com/images/media/meals/ustsqw1468250014.jpg”, “strTags”: “Pasta,Curry”,
“strYoutube”: “https://www.youtube.com/watch?v=1IszT_guI08”,
“strIngredient1”: “penne rigate”, “strIngredient2”: “olive oil”, “strIngredient3”: “garlic”, “strIngredient4”: “chopped tomatoes”, “strIngredient5”: “red chile flakes”, “strIngredient6”: “italian seasoning”, “strIngredient7”: “basil”, “strIngredient8”: “Parmigiano-Reggiano”, “strIngredient9”: “”,
“strIngredient10”: “”, “strIngredient11”: “”, “strIngredient12”: “”, “strIngredient13”: “”, “strIngredient14”: “”, “strIngredient15”: “”, “strIngredient16”: null, “strIngredient17”: null, “strIngredient18”: null, “strIngredient19”: null, “strIngredient20”: null, “strMeasure1”: “1 pound”, “strMeasure2”: “1/4 cup”, “strMeasure3”: “3 cloves”, “strMeasure4”: “1 tin “, “strMeasure5”: “1/2 teaspoon”, “strMeasure6”: “1/2 teaspoon”, “strMeasure7”: “6 leaves”, “strMeasure8”: “spinkling”, “strMeasure9”: “”,
12

“strMeasure10”: “”,
“strMeasure11”: “”,
“strMeasure12”: “”,
“strMeasure13”: “”,
“strMeasure14”: “”,
“strMeasure15”: “”,
“strMeasure16”: null, “strMeasure17”: null, “strMeasure18”: null, “strMeasure19”: null, “strMeasure20”: null,
“strSource”: null,
“strImageSource”: null, “strCreativeCommonsConfirmed”: null, “dateModified”: null
} ]
}
Note: The structure of the JSON returned by https://www.themealdb.com/ is not easy to work with. For example, it would be easier for us if it returned an array of ingredient measure objects rather than returning these as individually named properties like strMeasure13. In practice you will find many online APIs are badly designed and awkward to work with, so this is a good learning experience.
13

Marking Criteria:
This assessment is worth 30% of your total marks for this unit. You must submit a single iOS project that includes the functionality of all four exercises. Exercises 1, 2 and 4 are worth 20% of the assignment each, with Exercise 3 being worth 40%.
Each exercise will be marked against the following criteria:
● Implemented Functionality
Your exercise must successfully implement all required features of the application as outlined in the above instructions.
● Coding Quality
Your code should be readable and high quality. Your code should follow object-oriented design principles. The code should be well structured, with good method and property naming. The code should be well commented, and comments must explain application logic and the function of all code you have written. The code should follow appropriate iOS practices and patterns taught in FIT3178.
● Interface Design
Your User Interface for each exercise must have the required UI elements as outlined in the above instructions. These should be arranged using appropriate layout constraints, so they display appropriately on different iPhone sizes. The app should support Dark Mode and Dynamic Type. The interface should adhere to the Apple Human Interface Guidelines.
Feedback will be returned within two weeks to help assist you in building your final application for the semester. Your mark and feedback will be returned via in the Moodle Gradebook.
14

Submission Requirements:
Your assignment will need to be submitted online via Moodle. Your project should be submitted as a single iOS project compressed in a zip archive. Ensure that the archive is named using the following convention STUDENTNAME-A2-iOSPortfolioTasks.
Your submission will be marked according to the marking criteria described above. If you have any questions or concerns regarding any part of the portfolio tasks, feel free to post on the discussion forums on Moodle.
An interview will be conducted in your lab class in the week following submission to assess your understanding of the code for academic integrity purposes.
Ensure that any external resources that you used during development are referenced in your code (excluding unit material). Failure to reference resources used may be considered plagiarism and can result in a mark of 0 being awarded for the assessment.
Failure to submit your assignment on time will result in a 10%-mark penalty for each day late (including weekends) up to a maximum of 7 days late. Submissions later than 7 days will receive a mark of 0.
If you are unable to submit your assignment on time due to circumstances beyond your control, you may be able to apply for special consideration. Special consideration applications should be sent to Monash Connect via the following link: https://www.monash.edu/connect/forms/modules/course/special-consideration.
Supporting documentation will need to be submitted with the application.
15