FIT3178: iOS App Development
Assignment 2 – iOS Portfolio Exercises
Assignment 2: iOS Portfolio Exercises
Due Date: Friday Week 6 (1st May, 11:55PM) - Weight: 30%
Interview Date: Scheduled Week 7 Lab Class
Purpose:
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 follow a set of weekly portfolio tasks in order to create a Cocktail
Recipe app. This application will store a list of cocktails both fetched from an online API as well as
those entered by the user.
The application will support the following features (described in more detail below):
- A “My Drinks” screen that shows a list of all cocktails stored by the user
- A “Search Cocktails” screen for querying a web API for cocktails based on a name
- A “Create/Display Cocktail” screen for showing and editing the details of a cocktail
- An “Add Ingredient” screen for adding a new ingredient and quantity to a cocktail recipe
- An “Edit Name” screen for setting the name of a cocktail
- An “Edit Instructions” screen for setting the instructions for making a cocktail
The assessment is composed of four cumulative portfolio tasks, based on the content covered in
the first 5 weeks of semester. Note: you are not required to submit separate versions of the code
for each exercise, only 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 the
relevant lab work.
It is STRONGLY recommended that you work on Assignment 2 is week-by-week in order to
maintain a sensible workload. Do not leave it to the last minute.
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.
2
FIT3178: iOS App Development
Assignment 2 – iOS Portfolio Exercises
Exercise 1 – Build Application Shell:
For this exercise you will begin working on the Cocktail Recipe app by creating the application
shell. This will involve creating the overall application structure, including all screens and segues.
For screens using Table Views the functionality will be created in Exercise 2.
Part 1: Implement Data Classes (Cocktail, Ingredient and IngredientMeasurement)
You are required to develop a set of classes to represent a Cocktail, an Ingredient and an
Ingredient + Measurement. The classes should have the following properties.
Cocktail class:
- Name - String
- Instructions - String
- Ingredients - list of IngredientMeasurement class instances
IngredientMeasurement class:
- Name - String
- Quantity - String
Ingredient class:
- Name - String
Part 2: Create “My Drinks” screen
The next step is to begin setting up the My Drinks screen. This should be a UITableViewController
(subclass).
This screen should have a button for adding a new cocktail to the app. Tapping it should take the
user to the “Search Cocktails” screen. A manual segue should also be set up to the
“Create/Display Cocktail” screen (for displaying a saved drink).
You are not expected to set up the cells for the table view yet.
Part 3: Create “Search Cocktails” screen
For this step you are to create a UITableViewController for searching for new cocktails (which will
be loaded from a Web API in Task 4).
You should create a manual segue from this screen to the “Create/Display Cocktail” screen (for
entering a new cocktail). You are not required to implement this in code yet
You are not expected to set up the cells for the table view yet.
3
FIT3178: iOS App Development
Assignment 2 – iOS Portfolio Exercises
Part 4: Create “Create/Display Cocktail” screen
For this step you are to create a UITableViewController for displaying or entering details of a
cocktail. This screen will later be set up so that it can only be accessed if the search found no
results.
You should create manual segues to the “Edit Name”, “Edit Instructions” and “Add Ingredient
Measurement” screens. Again, you are not required to implement this in code yet.
Part 5: Create “Edit Name” screen
Next create a new View Controller for entering / editing a cocktail’s name. You are free to design
this screen as you see fit as long as it contains the following:
- 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 should return a valid result back to the “Create/Display Cocktail” View Controller via
delegation.
Part 6: Create “Edit Instructions” screen
Next create a new View Controller for entering / editing a cocktail’s instructions. You are free to
design this screen as you see fit as long as it contains the following:
- 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 should return a valid result back to the “Create/Display Cocktail” View Controller
via delegation.
Part 7: Create “Add Ingredient” screen
For this screen create a new View Controller for entering an ingredient and measurement amount.
You are free to design this screen as you see fit as long as it contains the following:
- A list of ingredients to select from (see UIPickerView)
- The ability to enter a measurement amount. There is no strict rule for what kinds of
measurements are allowed. This is just a string.
- A button for saving changes
The list of ingredients can be hardcoded for now. This will be updated in Exercise 3 and 4 to
utilise for Core Data and a Web API.
The action for saving changes should include sensible validation and should return a valid result
back to the “Create/Display Cocktail” View Controller via delegation.
4
FIT3178: iOS App Development
Assignment 2 – iOS Portfolio Exercises
Exercise 2 – Implementing My Drinks, Search Cocktails and
Create/Display Cocktail screens:
For this exercise you will work on implementing most of the functionality of the My Drinks, Search
Cocktails and Create/Display Cocktail screens. These will show a list of all saved cocktails, allow
searching for new cocktails (web query results will be implemented in exercise 4), and display
and allow creation/editing of a cocktail.
Part 1: Implement the My Drinks screen
For this task you are required to fully implement the My Drinks screen. This screen should display
a list of saved cocktails. This screen should be the entry point in the app.
At this point cocktails will not be saved upon closing the application. As such you might want to
hardcode some dummy data while testing.
The cells in this table view should display the drink name, and some other information (e.g.,
ingredients or the beginning of instructions). The design is left up to you. An example is shown
below:
A total number of saved drinks should be displayed as well.
Tapping on a cocktail should take the user to the “Create/Display Cocktail” screen (in edit mode)
with all fields pre-filled with the cocktail information.
The user should have the ability to delete Cocktails from the list. This must also update the saved
drinks count.
5
FIT3178: iOS App Development
Assignment 2 – iOS Portfolio Exercises
Part 2: Implement the Search Cocktails screen
For this task you are required to partially implement the “Search Cocktails” Screen. The screen
must display search bar that allows the user to enter a partial cocktail name to look for. This
search will utilise a Web API (to be completed in Exercise 4).
The table view should be empty until the user performs a search.
If there are known drinks matching the search, a list of all cocktails should be displayed.
Tapping a cocktail should add it to the user’s stored drinks and return to the “My Drinks” screen.
The search functionality need not be completed until the later step. For now, you may wish to
hard code a couple of cocktails as dummy “search results” whenever any search term is used.
If no matching cocktails are found, then the table view should display a row saying this and
inviting the user to add a new cocktail. Tapping this row should take the user to the
“Create/Display Cocktail” screen (in create mode).
Initial Entry Found Results No Results
6
FIT3178: iOS App Development
Assignment 2 – iOS Portfolio Exercises
Part 3: Implement the Create/Display Cocktail screen
For the final task in Exercise 2 you will work on implementing the full functionality of the
Create/Display Cocktail screen.
This screen must use include sections to display details of a cocktail. It should show the cocktail
name, instructions, a list of ingredients and the option to add more. This functionality must be
implemented using custom cells and multiple sections in a single UITableViewController. An
example of what this may look like is provided below.
If this screen is being used to show details of an existing drink, the details for the cocktail should
be pre-filled. The title shown in the navigation bar should also be set appropriately.
If this screen is being used to enter a new cocktail, then it should contain no pre-filled information.
The user should have the ability to delete ingredient cells (by swiping them) but no other cells.
Deleting an ingredient cell should remove the ingredient measurement from the cocktail.
Clicking the name cell should take the user to the Edit Name screen with the current name.
Clicking the instruction cell should take the user to the Edit Instructions screen with the current
instructions.
Ingredient cells should not be clickable.
Clicking 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 Drinks screen (after saving).
7
FIT3178: iOS App Development
Assignment 2 – iOS Portfolio Exercises
Exercise 3 – Implementing Core Data
For this exercise you will create a persistent database to store all available ingredients and the
user’s saved cocktails including their ingredient measurements. Previously you made use of
dummy data for testing purposes and all saved cocktails did not persist between application
runs. For data persistence you will use the Core Data framework.
Part 1: Create Core Data Cocktail class
For this task you must create a Cocktail 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
For this task you must 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
For this task you must 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 Cocktail entity.
Part 4: Write the Database Controller
For this task you must create a Database Controller class to encapsulate all communications
between the Application and its underlying Core Data database.
For full marks you are expected to create this following the design paradigm demonstrated in the
labs
This should contain the following functionality at a minimum:
- Create and return a Cocktail given a name and instructions
- Create and return an Ingredient given a name
- Add an IngredientMeasurement given the cocktail, ingredient name and measurement
- Remove an IngredientMeasurement from a Cocktail given them both.
- Fetch all Cocktails (using a fetched results controller)
- Fetch and return all Ingredients
- Fetch an Ingredient based on name (to prevent duplicates when creating Ingredients)
- Create and return a new empty Cocktail using a child managed object context
- A way to save changes to the child managed object context
- Create a list of default ingredients upon first launch (to be changed in Exercise 4)
- A way to save changes
- A way to add and remove listeners for the fetched results controller
8
FIT3178: iOS App Development
Assignment 2 – iOS Portfolio Exercises
Part 5: Update My Drinks screen
For this task you must update the My Drinks screen so that it shows all cocktails currently stored
within Core Data. You should also remove the default list used in Exercise 2 or place this within
the Core Data controller for first launch
Part 6: Update Display/Edit Cocktail screen
For this task you must update the Display/Edit Cocktail screen to use Core Data, and specifically
make it use a child managed object context for updating / changing the cocktail. 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.
Remember that managed objects can’t be shared between contexts, so if you are displaying an
existing cocktail for editing, you will need to ask the child context for a copy of that object using
its ID.
When the user swipes to delete an Ingredient Measurement it should be removed from the
cocktail.
When the Save button is tapped, any changes to the cocktail should be pushed to the main
context and saved.
If the user taps the Back button, no changes that they have made to the cocktail 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 cocktail.
9
FIT3178: iOS App Development
Assignment 2 – iOS Portfolio Exercises
Exercise 4 – Implementing Web API calls
For this exercise you will be communicating with an online cocktail API for getting information
about cocktail ingredients and for finding pre-existing cocktails. This exercise will complete the
development of the Cocktail app.
The web service we are using is CocktailDB API. Information on the full API features can be found
at https://www.thecocktaildb.com/api.php?ref=apilist.fun
Note: Whilst this portfolio exercise may appear shorter than others, the steps involved are quite
time consuming. DO NOT leave this until the last minute.
Part 1: Set Up 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
cocktail.
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 information to Core Data
The following link returns a JSON Object with an array of all available ingredients.
https://www.thecocktaildb.com/api/json/v1/1/list.php?i=list
{
"drinks": [
{
"strIngredient1": "Light rum"
},
{
"strIngredient1": "Applejack"
},
{
"strIngredient1": "Gin"
},
{
"strIngredient1": "Dark rum"
},
{
"strIngredient1": "Sweet Vermouth"
},
{
"strIngredient1": "Strawberry schnapps"
}
]
}
10
FIT3178: iOS App Development
Assignment 2 – iOS Portfolio Exercises
Part 2: Update Search Cocktail Screen
You are required to update the Search Cocktail screen so that when a search term is entered, it
queries the API for all drinks with a name matching the search term.
The user should be provided feedback as to when a query is being made and should not be
allowed to enter another search term until it has finished.
If no results are found the user should be provided with the option to create a new cocktail.
The following link returns a JSON Object with an array of drinks matching the search terms.
https://www.thecocktaildb.com/api/json/v1/1/search.php?s=margarita
{
"drinks": [
{
"idDrink": "11007",
"strDrink": "Margarita",
"strDrinkAlternate": null,
"strDrinkES": null,
"strDrinkDE": null,
"strDrinkFR": null,
"strDrinkZH-HANS": null,
"strDrinkZH-HANT": null,
"strTags": "IBA,ContemporaryClassic",
"strVideo": null,
"strCategory": "Ordinary Drink",
"strIBA": "Contemporary Classics",
"strAlcoholic": "Alcoholic",
"strGlass": "Cocktail glass",
"strInstructions": "Rub the rim of the glass with the lime slice to make the salt stick to
it. Take care to moisten only the outer rim and sprinkle the salt on it. The salt should present
to the lips of the imbiber and never mix into the cocktail. Shake the other ingredients with ice,
then carefully pour into the glass.",
"strInstructionsES": null,
"strInstructionsDE": "Reiben Sie den Rand des Glases mit der Limettenscheibe, damit das Salz
daran haftet. Achten Sie darauf, dass nur der äußere Rand angefeuchtet wird und streuen Sie das
Salz darauf. Das Salz sollte sich auf den Lippen des Genießers befinden und niemals in den
Cocktail einmischen. Die anderen Zutaten mit Eis schütteln und vorsichtig in das Glas geben.",
"strInstructionsFR": null,
"strInstructionsZH-HANS": null,
"strInstructionsZH-HANT": null,
"strDrinkThumb": "https://www.thecocktaildb.com/images/media/drink/wpxpvu1439905379.jpg",
"strIngredient1": "Tequila",
"strIngredient2": "Triple sec",
"strIngredient3": "Lime juice",
"strIngredient4": "Salt",
"strIngredient5": null,
"strIngredient6": null,
"strIngredient7": null,
"strIngredient8": null,
"strIngredient9": null,
"strIngredient10": null,
"strIngredient11": null,
"strIngredient12": null,
"strIngredient13": null,
"strIngredient14": null,
"strIngredient15": null,
"strMeasure1": "1 1/2 oz ",
"strMeasure2": "1/2 oz ",
"strMeasure3": "1 oz ",
"strMeasure4": null,
"strMeasure5": null,
11
FIT3178: iOS App Development
Assignment 2 – iOS Portfolio Exercises
"strMeasure6": null,
"strMeasure7": null,
"strMeasure8": null,
"strMeasure9": null,
"strMeasure10": null,
"strMeasure11": null,
"strMeasure12": null,
"strMeasure13": null,
"strMeasure14": null,
"strMeasure15": null,
"strCreativeCommonsConfirmed": "No",
"dateModified": "2015-08-18 14:42:59"
}
]
}
Note: We are aware that the structure of the JSON returned by https://www.thecocktaildb.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 an 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.
12
FIT3178: iOS App Development
Assignment 2 – iOS Portfolio Exercises
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 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 will be reflected in the Moodle Gradebook with written feedback.
13
FIT3178: iOS App Development
Assignment 2 – iOS Portfolio Exercises
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 help 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 5%-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.