Technical Test
Create a little Record application and using Pinata for API.
The project must be open with Xcode 13.2.1, if not the app can’t build. I join a video of the application (if you can build this app)
The user can :
- create a recording
- listen to it
- delete
Each a user finish a recording, the file is upload to Pinata.
When the user delete a recording, the file is delete on Pinata and locally
Architecture
I use a MVVM archicure with DDD (Domain Driven Design).
And this will produce a flow chart:
graph LR
A[View] --> B[ViewModel]
B --> C[Repository]
B --> A
C --> D[Network]
C --> E[Database]
C --> F[Audio]
(If you’re not seeing the diagram, you can add this extension to see mermaid diagram)
My folder are split in :
|- Model
|- Component
|- Data
|- Repository
|- Services
|- Resources
The Component folder is split in Model to easily find View,Format or anything else related to a Model
The Data folder is spit in Repository and Service. Respository is only used the ViewModel to get the right data. The Repository is the only place that know where the data came from. The Services contains all the logic about Network, Storage ,Audio …
All Repository and Service have some protocol (easy to change implementation if we want)
I create a propertyWrapper to be able to use some dependency injection
UnitTests
Only Model, ViewModel and Repository classes can be test. All Repositoryand Service should be mock for test.
Actually only RecordRepository has some tests
Localization
This app is not translate, but maybe use SwiftGen
Package
I use
http: (package develop my me for Aircall), It only useURLSessionwithCombinewithout any librarby , I update it to handle themultipartformGRDB: for Sql database
Completion
This code is not ready for Production because it’s missing:
- unitTests:
RepositoryandViewModelare not fully tested - need a better UI
- the app need to be translated