Skip to content

g-enius/Fun

Repository files navigation

Fun - iOS Demo App

A modern iOS application demonstrating clean architecture (MVVM-C), Swift Concurrency, modular design with Swift Package Manager, and best practices for scalable iOS development.

Demo

App Demo

Tech Stack

Category Technology
Language Swift 6.0
UI Framework SwiftUI + UIKit
Reactive & Concurrency Combine, Swift Concurrency (async/await)
Architecture MVVM + Coordinator
Dependency Injection Session-Scoped DI + Property Wrapper
Package Management Swift Package Manager
Minimum iOS iOS 15.0
Testing Swift Testing, swift-snapshot-testing

Module Structure

Fun/
├── Application/    # iOS app entry point
├── Coordinator/    # Navigation coordinators
├── UI/             # SwiftUI views & UIKit controllers
├── ViewModel/      # Business logic (MVVM)
├── Model/          # Data models & protocols
├── Services/       # Concrete service implementations
└── Core/           # Utilities, DI container, L10n

Dependency Hierarchy:

Application → Coordinator → UI → ViewModel → Model → Core
                Services ────────────────────┘

Key Patterns

MVVM + Coordinator

  • ViewModel: Business logic, state management
  • View: Pure UI (SwiftUI)
  • Coordinator: Navigation flow, screen transitions

Session-Scoped Dependency Injection

Each app flow gets its own session with a dedicated set of services. When the flow changes, the old session tears down and a fresh one activates — no stale state leaks between login and main.

LoginSession:         logger, network, featureToggles
AuthenticatedSession: logger, network, featureToggles, favorites, toast
// Sessions activate/teardown automatically on flow transitions
protocol Session: AnyObject {
    func activate()   // register services
    func teardown()   // reset ServiceLocator
}

// ViewModels resolve lazily — no changes needed
@Service(.network) var networkService: NetworkService

Protocol-Oriented Design

All services defined as protocols in Model, implementations in Services.

App Flow Management

AppCoordinator manages login/main flow transitions with session lifecycle.

Deep Linking

URL scheme funapp:// for navigation:

  • funapp://tab/items - Switch to Items tab
  • funapp://item/swiftui - Open item detail
  • funapp://profile - Open profile

Test from terminal:

xcrun simctl openurl booted "funapp://tab/items"
xcrun simctl openurl booted "funapp://item/swiftui"

Deep links received during login are queued and executed after authentication.

Screenshots

Login Home Items Settings
Login Home Items Settings

Features

  • Session-Scoped DI: Clean service lifecycle per app flow — no stale state
  • Reactive Data Flow: Combine framework with @Published properties
  • Feature Toggles: Runtime flags persisted via services
  • Error Handling: Centralized AppError enum with toast notifications
  • Modern Search: Debounced input, loading states
  • Pull-to-Refresh: Native SwiftUI .refreshable
  • iOS 17+ APIs: Symbol effects, sensory feedback (backwards compatible)

UIKit + SwiftUI Hybrid

UIKit for navigation (reliable Coordinator pattern), SwiftUI for content.

Use Case Framework
Navigation/Presentation UIKit (UINavigationController + Coordinators)
Content & Layout SwiftUI (all views)
Forms & Settings SwiftUI

Testing

  • Unit Tests: ViewModels, services, and session lifecycle
  • Session DI Tests: Activation, teardown, transitions, state isolation
  • Snapshot Tests: Visual regression testing for all views
  • Parameterized Tests: Swift Testing with custom scenarios

Getting Started

Requirements

  • Xcode 16.0+
  • iOS 15.0+
  • Swift 6.0

Installation

git clone https://github.com/g-enius/Fun.git
cd Fun
open Fun.xcworkspace

Running

  1. Open Fun.xcworkspace
  2. Select FunApp scheme
  3. Choose simulator (iPhone 17 Pro recommended)
  4. Cmd + R to build and run

Tests

xcodebuild test -workspace Fun.xcworkspace -scheme FunApp \
  -destination 'platform=iOS Simulator,name=iPhone 17 Pro'

Code Quality

  • SwiftLint with strict rules (no force unwraps)
  • GitHub Actions CI (lint, build, test)
  • OSLog structured logging
  • SwiftGen for type-safe localization

AI-Assisted Development

This project demonstrates AI-assisted iOS development using Claude Code with MCP integration.

Claude Code Demo

Architecture and patterns designed by developer. Claude assisted with:

  • Feature implementation
  • Bug fixes
  • Test coverage
  • Documentation

Commits with AI assistance include Co-Authored-By: Claude attribution.


MIT License

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •