iOS application developed as my first assignment for COMP327 - Mobile Computing at University of Liverpool.
It's my first attempt to develop an iOS app using the MVVM pattern + RxSwift
UPDATE: I got full marks for this project 😉!
To run this project, you will need:
- Xcode 8.+
- Swift 3.0.+
- Carthage dependency manager
When downloading the project, please run
carthage update --platform iOS --no-use-binaries
to generate the proper build versions for your local configuration
This project uses the Model-View-ViewModel pattern, in combination with RxSwift. Basically, the view model will emmit streams of data for which the view will subscribe (using Rx observables) to update its UI. For further info about this, you can check here, here and here
This are the models used to represent the data in the app. Every model has a unique ID
- Questionnaire: represents a collection of questions. Has a
title
adescription
, and a set ofQuestion
s - Question: represents an specific question from the questionnarie. Has
title
, a collection ofChoice
s, and a type.- Text: a question where the user has to type his answer. Will only have ONE choice, of type text
- Numeric: a question where the user can pick a numeric value. Will only have ONE choice, of type numeric
- Single option: a question that displays a list of choices, and only allows the user to select one
- Multiple option: a question that displays a list of choices, and allows the user to select as many as he wants
- Choice: represents a choice within a question.
- Text: has a
question
and ahint
- Numeric: has a
min
andmax
value - Single/Multiple option: has a
label
and optionalvalue
- Text: has a
- Answer: represents an answer for a question. It's generated when the user completes the questionnaire, and saves the
questionnaireId
and thequestionId
. There is only one type of answer, but its data will be set differently depending on the question type
The data can be access by four different ways:
- Web service: That will return a json file with the questionnaire information. To see the json structure used in this app, you can check the URL that the app consumes. This is managed in the
QuestionnaireService
- JSON file: there are a couple of .json files inside the projects that contain a json with the same structure as the one used in the web service. This is managed in the
QuestionnaireFileSource
- Core data: once the user completes the questionnaire, his answers are saved in Core Data. This is managed in the
AnswerCoreData
- Simulated data: this generates random answers data, in case you feel too lazy to answer the questionnaire. This is managed in the
AnswerSimulatedRepo
The app supports multiple targets to show the usage of the Injection
class. At this moment, there are 3 targets:
- Questionnaire A: uses the
QuestionnaireRepository
to access the data - Questionnaire B: uses the
QuestionnaireFileSource
to access the data - Questionnaire C: uses the
QuestionnaireFileSource
andAnswerSimulatedRepo
to access the data
This is managed under the Injection folder (notice how every Injection
belongs to a different target)
The frameworks used in this project are: