App for LifeSum code challenge.
App downloads food item info using special link and display it to user. Successful results are cached. Failure results are dropped and new attempt to download is started.
The challenge condition said that any tools could be used, so I decided to use the most recent technologies with one limitation: as low as possible third party libs should be used. As a result app based on SwiftUI framework with iOS 15 capability.
Project and code generation is done using XcodeGen and SwifGen tools. So they must be installed on the local mac
Just run 'xcodegen' terminal command from project directory and you're done.
- App layer
- Frameworks layer
App layer based on MVVM architecture with navigation through coordinators. Frameworks is a hierarchical structured layers with unidirectional dependency. Topmost framework can use frameworks from lowest layers.
Core Contains most basic extensions and utilities
Localization Contains localized resources generated with Swiftgen scripts from source localization file
Assets Contains assets catalogs for icons and colors. Generates classes with Swiftgen scripts
Entities Contains structure for the needs of application
AppLogger Represents logger interface. Uses SwiftBeaver as a third party dependency. I prefer to use a lib cause it provides different log levels out of the box.
API Wraps client server communication through the REST API. Interface use async\await methods. I chose not to use third-party dependencies and for this reason I had to raise system requirements to iOS 15
Storage Persistent storage layer used for data cache and currently represented by simple UserDefaults
Mocks: Reflects API interface and this is the only reason why it higher then Level 1
Services Provides data to the app. Incapsulates caching and client-server communication. Uses combine framework.
UI Collection of the most basic Views and UI extentions. Based on the SwiftUI framework. Perhaps version 2 (iOS 14) may be enough for a full-fledged work.
Dependencies DI tool. Contains public services interfaces.
- Much more unit tests. Don’t have enough time to write them
- May downgrade system requirements if replace URLSession with some third-party framework that supports async\await methods. Or if wraps old-style closure based API to support async\await on iOS 13+. But first version of SwiftUI is quite unstable so iOS 14 is a minimum.
- Replace UserDefaults in Storage framework to something more advanced such as CoreData, Realm, GRDB etc.