Skip to content

WellysaAI iOS

AI-powered wellness application for iOS with multi-environment support and modular architecture.

Requirements

  • iOS 17.0+ (unverified — confirm deployment target in project.pbxproj)
  • Xcode 16.0+ (unverified — confirm recommended version)
  • Swift 5.0+

Tech Stack

Dependencies (unverified — confirm in Package.swift and Package.resolved)

  • Firebase (Analytics, Crashlytics) — crash reporting and analytics
  • SFSafeSymbols — type-safe SF Symbols access
  • SwiftLint — Swift code linting and style enforcement
  • SwiftGen — code generation for localization, fonts, and assets

Development Tools

Install required tools via Homebrew:

bash
brew install swiftlint swiftgen

SwiftGen runs automatically on build to regenerate type-safe accessors.

Project Structure

WellysaAI_iOS/
├── Core/                           # Business logic SPM package
│   └── Sources/
│       ├── CloudflareService/      # Cloudflare API integration
│       ├── DomainTypes/            # Shared models and errors
│       │   ├── General/            # App-wide types (errors, models)
│       │   └── Onboarding/         # Onboarding flow types
│       └── Repositories/           # Data persistence layer (UserDefaults)

├── WellysaAI_iOS/                  # Main application target
│   ├── Assets.xcassets/            # Image assets (logo, lettermark, app icon)
│   ├── Colors.xcassets/            # Color design tokens
│   └── (additional views/providers — structure TBD)

├── Generated/                      # SwiftGen output (do not edit manually)
│   ├── Strings.swift               # Type-safe localized strings
│   └── Fonts.swift                 # Type-safe Montserrat font accessors

├── Resources/                      # Static resources
│   ├── en.lproj/                   # English localization
│   ├── pl.lproj/                   # Polish localization
│   ├── Montserrat/                 # Montserrat font family (Regular, Medium, SemiBold, Bold)
│   └── GoogleService-Info.plist    # Firebase configuration

└── Config/                         # Environment configurations
    ├── Dev.xcconfig                # Development environment
    ├── Stage.xcconfig              # Staging environment
    └── Prod.xcconfig               # Production environment

Architecture

Provider Pattern

The app uses a Provider pattern (analogous to ViewModel in MVVM) with strict dependency injection for testability:

┌─────────────────────────────────────────────────────────┐
│                      SwiftUI Views                      │
│              (Presentation layer only)                  │
└───────────────────────┬─────────────────────────────────┘


┌─────────────────────────────────────────────────────────┐
│                      Providers                          │
│         (@MainActor, ObservableObject)                  │
│      Coordinate UI state & business logic calls         │
└───────────────────────┬─────────────────────────────────┘


┌─────────────────────────────────────────────────────────┐
│              Core SPM Package                           │
│         Services, Repositories, Domain Types            │
└─────────────────────────────────────────────────────────┘

Core Package

Local Swift Package Manager module containing all business logic. Exposes multiple targets:

TargetPurpose
DomainTypesShared models, enums, errors (AppError, AppLanguage, ChatModels, UserData, OnboardingStep)
RepositoriesData persistence abstractions (SettingsRepository, UserDataRepository)
CloudflareServiceCloudflare API integration with error handling and request building

Dependency Injection Pattern

Providers use constructor injection with a Dependencies struct for full testability:

swift
@MainActor
final class ExampleProvider: ObservableObject {
    struct Dependencies {
        var fetchData: () async throws -> String
    }

    private let dependencies: Dependencies

    init(dependencies: Dependencies) {
        self.dependencies = dependencies
    }
}

// Production instance
extension ExampleProvider {
    static let live = ExampleProvider(dependencies: .init(
        fetchData: { try await ExampleService().fetchData() }
    ))
}

// Mock for testing/previews
extension ExampleProvider {
    static let mock = ExampleProvider(dependencies: .init(
        fetchData: { "Mock data" }
    ))
}

Multi-Environment Setup

The project supports three build environments via .xcconfig files and Xcode schemes:

  • Dev (Dev.xcscheme) — Development environment with debug features
  • Stage (Stage.xcscheme) — Pre-production staging environment
  • Prod (Prod.xcscheme) — Production release environment

Environment-specific configuration is managed in Config/ directory. Switch environments by selecting the corresponding scheme in Xcode.

Cloudflare Integration

The CloudflareService module handles communication with Cloudflare APIs:

  • CloudflareService.swift — Main service implementation
  • RequestBuilder.swift — HTTP request construction
  • CloudflareError.swift — Typed error handling for API failures

(Unverified — confirm endpoints, authentication strategy, and usage patterns in source files)

Design System

Design tokens synchronized with Figma for consistent styling:

  • Spacing — 8pt grid system (unverified location — check CGFloat+DesignSystem.swift or Utils/)
  • Typography — Montserrat font family (Regular, Medium, SemiBold, Bold) via SwiftGen-generated Fonts.swift
  • Colors — Design tokens in Colors.xcassets (Black900, Gray200, Gray300, with opacity variants like Black900A40)

Localization

The app supports English and Polish localization via SwiftGen:

swift
// ❌ Avoid stringly-typed localization
Text("welcome_message")

// ✅ Use type-safe SwiftGen accessors
Text(Strings.welcome)

Adding New Localized Strings

  1. Add key-value pair to Resources/en.lproj/Localizable.strings
  2. Add corresponding translation to Resources/pl.lproj/Localizable.strings
  3. Build project — SwiftGen regenerates Generated/Strings.swift automatically
  4. Access via Strings.* in code

App Configuration

SettingValue
Supported color schemesLight mode only
Dynamic TypeCapped at .xxLarge
Supported orientationsPortrait only
Minimum iOS version17.0
LocalizationEnglish (en), Polish (pl)

Firebase Integration

  • Firebase Analytics — User engagement and behavior tracking
  • Firebase Crashlytics — Crash reporting and stability monitoring

Configuration loaded from Resources/GoogleService-Info.plist. Ensure this file is present and matches your Firebase project for each environment.

Code Quality

SwiftLint

Code style and linting rules defined in .swiftlint.yml. Runs automatically on build via Xcode Run Script Phase.

Generated Code

Files in Generated/ are auto-generated by SwiftGen during build. Do not edit manually — changes will be overwritten on next build.

Development Workflow (unverified — confirm with team)

  1. Select appropriate scheme (Dev/Stage/Prod) in Xcode
  2. Build project — SwiftGen and SwiftLint run automatically
  3. Use type-safe accessors (Strings.*, Fonts.*) for resources
  4. Follow Provider pattern for new features with DI-based testing
  5. Add localization keys to both .lproj files before referencing in code

Status

Active development. Architecture established with Provider pattern, multi-environment support, and modularized Core package. Onboarding flow and chat models infrastructure in place.

Wellysa Consigliere — internal use only.