TaskForce is a small app that gives you opportunity to assemble your own squad of Marvel Characters.
Main Screen | Character Details |
![]() |
![]() |
- Communication with REST API via URLSession
- Persistence is implemented with Core Data
- Combine based MVVM architecture
- Localization
- Assets generation with SwiftGen
- Xcode 13+
- brew
- Marvel API
private key
andpublic key
To use the Marvel API you need to sign up for a developer account. Once you sign up you will find your API keys in the Account section.
It's important to add "*" as an Authorized Referrer in the Account section.
- Clone the project
- Open terminal and navigate to project directory
- Run
chmod +x ./install.sh
- Run
./install.sh
- Script will ask you to enter your MARVEL API
public key
andprivate key
, to add them toCredentials.plist
which is ignored bygit
- Open
TaskForce.xcodeproj
- Wait till SPM dependencies are downloaded
- Run!
- Project is structured in a way to give a glance on how modular approach can be achieved. Although it is pretty common to start project as a monolith, modularizing an app from the beginning is a good practice in long term, especially since Apple provided this opportunity with local Swift Packages. Modular architecture is usually applied when a project starts to grow, to reduce build time and simplify project support especially when there are several teams working on it.
- Shared folder is intended to be the place for all code that can be shared between different targets or apps (i.e. UIKit app and SwiftUI app). It includes two Swift Packages:
ImageDownloader
andTaskForceCore
. ImageDownloader
is a thin wrapper aroundKingfisher
library. This wrapper is created to simplify Unit-testing, and also it gives us opportunity to replaceKingfisher
with any other solution painlessly, if we need that, and there is no need to modify actual app code in this case.TaskForceCore
is a module that contains all the business logic that is not related to specific target or app implementation.
MVVM
is used as a base architecture for presentation layer, because it gives better control of UI-state consistency thanMVP
orMVC
, while keeping the entry level low. Also it works well with bothUIKit
andSwiftUI
.- Routing is inspired by
Coordinator
pattern and is implemented inAppFlowController
. The difference between commonCoordinator
implementation and the one used in this project, is thatCoordinator
is not a simple class, but a subclass of aUIViewController
/UINavigationController
/UITabViewController
. This is done because commonCoordinator
implementations usually need to either manually handle their life-cycle, which is an error-prone process, or have a lot of custom logic for doing it under the hood, also they either useUIKit
objects to actually perform navigation or create a bunch of classes to abstract this work. Current approach was chosen because it keeps the navigation logic simple, by leveragingUIKit
APIs of container view controllers and presentation methods (i.e.show(_:sender:)
).
- Screen logic is located in
TaskForce/UserStories
folder. CharactersList
supports infinite scrolling and consists of two sections:- Your squad, which shows all the characters that you've recruited. Squad persists between launches.
- All Characters.
CharacterDetails
shows you a brief informatio about the character and gives you opportunity to recruit of fire a character.- These modules are created in
AppModulesFactory
, that is owned byAppFlowController
. AppModulesFactory
usesDependenciesRegistry
class to obtain dependencies like services, repositories, etc.
Swiftlint
is used to lint code files and maintain consistency of code style.SwiftGen
is used to generate enums for compile-time safety of assets and localizable strings.
This project is written in Swift 5.5 and requires Xcode 13 or newer to build and run.
TaskForce is compatible with iOS 14.0+.
- Add Persistence Tests
- Add ViewModel Tests
- Add UITests
- Reachability
- Add SwiftUI version
Copyright 2022 Igor Kokoev.
Licensed under MIT License: https://opensource.org/licenses/MIT