Skip to content

laGrave/LifeSum-Challenge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LifeSum-Challenge

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

Simulator Screen Shot - iPhone 13 mini - 2022-07-13 at 23 32 46

Installing

Just run 'xcodegen' terminal command from project directory and you're done.

App Structure

  1. App layer
  2. 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.

Level 0

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.

Level 1

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

Level 2

Mocks: Reflects API interface and this is the only reason why it higher then Level 1

Level 3

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.

Level 4

Dependencies DI tool. Contains public services interfaces.

Potential improvements:

  • 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.

About

LifeSum code challenge

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published