Warning
This project is archived and no longer maintained.
Started in 2016, TennisApp was a personal playground: over the years I used it to learn new things, try out architectural patterns (Clean Architecture, MVVM + Coordinators, DI containers) and experiment with frameworks and APIs (Combine, Core Data, SwiftUI inside UIKit, modern collection views). Expect unfinished features and work-in-progress code. This proof of concept hasn't been actively developed for many years and would now need to be rethought from a different perspective.
| Login | Activities | Rackets | Racket form |
|---|---|---|---|
![]() |
![]() |
![]() |
![]() |
To run the project, clone the repo, open with Xcode and run from TennisApp target. To run unit tests type CMD + U
TennisApp/GoogleService-Info.plist contains placeholder values: to use Firebase Authentication, replace it with the file downloaded from your own Firebase project.
- Xcode 16+
- Swift 5.9+
- Deployment target iOS 18+
- Swiftlint to enhance code styling
You can install those tools from terminal:
brew update
brew install swiftlintThe app follows a Clean Architecture layout with MVVM + Coordinators in the presentation layer. UIKit is the main UI framework; some screens (Settings, SignUp, Stats) host SwiftUI views inside a UIKit view controller.
TennisApp/
├── Application # Entry point, AppCoordinator, DI containers
├── Presentation # Coordinators, ViewControllers, ViewModels, Design Library
├── Domain # Models, UseCases, Repository protocols (no framework dependencies)
├── Data # Repository implementations, Core Data / UserDefaults storage
├── Infrastructure # Firebase service, Logger
└── Resources # Localizable.xcstrings
flowchart LR
VC[ViewController] --> VM[ViewModel]
VM -- Combine --> VC
VM -- coordinatorDelegate --> C[Coordinator]
VM --> UC[UseCase]
UC --> R["Repository (protocol)"]
R --> LS["LocalStorage (protocol)"]
LS --> CD[(Core Data)]
DR["Default*Repository (Data layer)"] -. implements .-> R
CDS["*CoreDataStorage (Data layer)"] -. implements .-> LS
Dependencies point inwards: Domain defines the protocols (RacketsRepository, RacketsFetchUseCase, …) and the Data layer implements them.
- Application
SceneDelegatecreates the window and starts theAppCoordinator(UIScene life cycle).AppCoordinatorbuilds theUITabBarControllerwith five tabs (Activities, Rackets, Stats, Profile, Settings) and handles the Login / SignUp flows.AppDIContainerlazily owns one DI container per feature (RacketsDIContainer,StringsDIContainer,ProfileDIContainer, …). Each feature container exposesmake…UseCase()factories and privately wires repositories and storages.
- Presentation
- Coordinators (
Coordinator,TabBarItemCoordinator) own navigation: they instantiate view controllers, inject view models and push child coordinators (e.g.RacketsCoordinator→StringsCoordinator,RacketFormCoordinator). Child coordinators report back via delegate protocols (…CoordinatorDidFinish). - ViewModels receive use cases through their initializer, expose state to the view via Combine publishers (
PassthroughSubject/AnyPublisher, seeBindableViewModelType) and request navigation through a weakcoordinatorDelegate. - ViewControllers are loaded from one storyboard each (
StoryboardInstantiable). Lists use modernUICollectionViewlist layouts with custom content configurations (*ContentView+*ListCell+ cell*ViewModel). - Forms are built with Eureka through
FormFactory(RacketForm,StringForm,MatchForm). - DesignLibrary centralizes design tokens (colors, fonts, SF Symbols, misc assets) behind
DesignLibraryProvider. - Shared behaviours are expressed as protocols:
Alertable,LoadingIndicator,BackgroundBlurrable,Bindable.
- Coordinators (
- Domain
- Plain Swift models:
User,Racket,Strings,Match,MatchScore,Practice,Workoutand enums (GripSize,RacketBrand,StringsBrand,Sport). - One use case per operation (
RacketsFetchUseCase,RacketSaveUseCase,RacketDeleteUseCase, …), each with aDefault…implementation that delegates to a repository. - Repository protocols (
RacketsRepository,StringsRepository,UsersRepository).
- Plain Swift models:
- Data
Default…Repositoryimplementations, backed by a…LocalStorageprotocol.CoreDataStoragewraps theNSPersistentContainerfor theAppCoreDataModelmodel (entities:UserEntity,RacketEntity,StringsEntity,MatchEntity,MatchScoreEntity,PracticeEntity,WorkoutEntity).…CoreDataStorageclasses perform the fetch/save/delete requests;LocalEntityextensions map between Core Data entities and domain models (toDomain()/init(racket:insertInto:)).UserDefaultsStoragefor lightweight preferences.
- Infrastructure
FirebaseServicewraps Firebase Auth (sign in / sign up / sign out) behindFirebaseServiceType.Logis a pluggable logger with console and null profiles.
Rackets, Strings and Users go through the full UseCase → Repository → Core Data pipeline. Activities (matches, practices, workouts) and Stats have domain models and Core Data entities, but no use cases or repositories yet. Data access is still callback-based (Result completion handlers); moving to async/await is tracked below.
| Package | Usage |
|---|---|
| Firebase | Authentication |
| Eureka + ImageRow | Racket / Strings / Match forms |
| Parchment | Paging menu in the Activities tab |
| IQKeyboardManager | Declared in the project but not currently imported in code |
Native Apple frameworks: UIKit, SwiftUI, Combine, Core Data, Swift Charts (Stats).
TennisAppTests covers the Core Data storages (using CoreDataStorageMock, an in-memory store) and NavigationControllerBuilder.
- [] Add forms for activities
- [] Complete SignUp page
- [] Add DTO to decouple domain model from CoreDataStorage
- [] Entity relationships
- [] Add builder to convert form to Model (formValues -> ´Rackets´)
- [] Convert repository with async/await
- [] See https://github.com/AvdLee/StockAnalyzerApp for Terms and Privacy
- [~] Use Modern cell configuration
- [~] Create repositories
- [~] Create UseCases
- [~] CRUD operation for User, Match and others
- Settings View in SwiftUI
- SignUp view in SwiftUI
- Implementing Modern Collection Views (https://swiftsenpai.com/development/uicollectionview-list-basic/) instead of UITableView
- Add Design Library
- Refactor localization
- Add DI containers
- Create domain model
- Rename RealmStorage protocols
- Remove Realm and use CoreData
- Split Storyboard (use one storyboard for each controller)
- RacketFormViewModel refactor using Racket instead RacketEntity
- Remove FontAwesome
- Remove MBProgressHUD
- Use TabBarController instead of RESideMenu
- CRUD operation for Racket
-
FirebaseServiceaddResulttype instead of completion block - Use Combine instead of Bond
- Remove
SCLAlertView
- https://betterprogramming.pub/uikit-mvvm-combine-912c80c02262
- https://betterprogramming.pub/form-validation-in-uikit-made-easy-with-combine-dd8245bacb6c
- Clean architecture apps:
Andrea Stevanato



