# App Client Base Swift > Native iOS client application for GoodGo platform, built with Swift and SwiftUI following MVVM architecture. ## ๐Ÿ“ฑ Features | Feature | Description | |---------|-------------| | ๐Ÿ” Authentication | Login, Register, Forgot Password with form validation | | ๐Ÿ  Home Dashboard | Dynamic greeting, Featured items, Activity feed | | ๐Ÿ” Explore | Discover locations and services | | ๐Ÿ‘ค Profile | User profile management and settings | | ๐ŸŒ“ Dark Mode | Automatic dark mode support | | ๐ŸŒ i18n | Multi-language support (Vietnamese & English) | ## ๐Ÿ› ๏ธ Tech Stack | Technology | Version | Purpose | |------------|---------|---------| | Swift | 5.9+ | Primary language | | SwiftUI | iOS 15+ | Declarative UI framework | | Xcode | 15.0+ | IDE development | | URLSession | Native | HTTP networking | | Keychain | Native | Secure token storage | | Combine | Native | Reactive programming | ## ๐Ÿ“‹ Prerequisites - **macOS**: 14.0+ (Sonoma) - **Xcode**: 15.0+ - **iOS Target**: 15.0+ - **Apple Developer Account**: Required for device deployment ## ๐Ÿš€ Quick Start ### 1. Clone and open project ```bash cd apps/app-client-base-swift open AppClientBaseSwift/AppClientBaseSwift.xcodeproj ``` ### 2. Select Simulator - Xcode menu: **Product > Destination > iPhone 15 Pro** (or another simulator) ### 3. Build and Run ```bash # Using shortcut โŒ˜R (Command + R) # Or from terminal xcodebuild -project AppClientBaseSwift/AppClientBaseSwift.xcodeproj \ -scheme AppClientBaseSwift \ -destination 'platform=iOS Simulator,name=iPhone 15 Pro' \ build ``` ### 4. Mock Login (for testing) ``` Email: admin@goodgo.com Password: 123456 ``` ## ๐Ÿ“‚ Project Structure ``` AppClientBaseSwift/ โ”œโ”€โ”€ App/ โ”‚ โ””โ”€โ”€ AppClientBaseSwiftApp.swift # @main entry point โ”‚ โ”œโ”€โ”€ Core/ โ”‚ โ”œโ”€โ”€ Constants/ โ”‚ โ”‚ โ””โ”€โ”€ Constants.swift # API, App, Storage, DesignSystem โ”‚ โ””โ”€โ”€ Extensions/ โ”‚ โ”œโ”€โ”€ View+Extensions.swift # SwiftUI modifiers โ”‚ โ””โ”€โ”€ String+Extensions.swift # Validation, formatting โ”‚ โ”œโ”€โ”€ Models/ โ”‚ โ””โ”€โ”€ User.swift # User entity + extensions โ”‚ โ”œโ”€โ”€ ViewModels/ # MVVM ViewModels โ”‚ โ”œโ”€โ”€ AuthViewModel.swift # Login/Register/ForgotPassword โ”‚ โ”œโ”€โ”€ HomeViewModel.swift # Home screen logic โ”‚ โ””โ”€โ”€ ProfileViewModel.swift # Profile management โ”‚ โ”œโ”€โ”€ Views/ โ”‚ โ”œโ”€โ”€ Auth/ # Authentication screens โ”‚ โ”œโ”€โ”€ Home/ # Home components โ”‚ โ””โ”€โ”€ Screens/ # Main screens โ”‚ โ”œโ”€โ”€ Services/ โ”‚ โ”œโ”€โ”€ APIService.swift # HTTP client with URLSession โ”‚ โ””โ”€โ”€ AuthManager.swift # Auth state + Keychain โ”‚ โ””โ”€โ”€ Resources/ โ”œโ”€โ”€ Assets.xcassets/ # Images & Colors โ”œโ”€โ”€ en.lproj/ # English localization โ””โ”€โ”€ vi.lproj/ # Vietnamese localization ``` ## ๐ŸŽจ Architecture ### MVVM Pattern ``` โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ VIEW (SwiftUI) โ”‚ โ”‚ HomeView, ProfileView, AuthContainerView, LoginView... โ”‚ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ @StateObject / @EnvironmentObject โ”‚ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ VIEWMODEL (ObservableObject) โ”‚ โ”‚ HomeViewModel, AuthViewModel, ProfileViewModel โ”‚ โ”‚ โ€ข @Published properties for reactive UI โ”‚ โ”‚ โ€ข async/await methods for data loading โ”‚ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ Protocol-based Dependency Injection โ”‚ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ SERVICES โ”‚ โ”‚ APIService (HTTP) โ€ข AuthManager (Auth State + Keychain) โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ ``` ## ๐Ÿ“‹ Coding Conventions ### File Structure ```swift // MARK: - Imports import SwiftUI // MARK: - Type Definition /// Description in English struct/class/enum TypeName { // MARK: - Properties // MARK: - Init // MARK: - Public Methods // MARK: - Private Methods } ``` ### ViewModel Pattern ```swift @MainActor final class FeatureViewModel: ObservableObject { @Published var isLoading = false @Published var errorMessage: String? private let apiService: APIServiceProtocol init(apiService: APIServiceProtocol = APIService.shared) { self.apiService = apiService } func loadData() async { isLoading = true defer { isLoading = false } // ... } } ``` ## โš™๏ธ Configuration ### API Configuration ```swift enum APIConfig { static let baseURL = "https://api.goodgo.vn" static let apiVersion = "/api/v1" static let timeout: TimeInterval = 30.0 } ``` ## ๐Ÿงช Testing ```bash xcodebuild test \ -project AppClientBaseSwift/AppClientBaseSwift.xcodeproj \ -scheme AppClientBaseSwift \ -destination 'platform=iOS Simulator,name=iPhone 15 Pro' ``` ## ๐Ÿ” Security | Feature | Implementation | |---------|----------------| | Token Storage | Keychain Services (not UserDefaults) | | Secure Requests | HTTPS only, Bearer token auth | | Session Management | Auto token refresh, secure logout | | Data Protection | Sensitive data encrypted at rest | ## ๐Ÿ“ฑ Supported Devices - **iPhone**: 8 and later (iOS 15+) - **iPad**: All iPads with iOS 15+ - **Orientations**: Portrait (primary), Landscape (supported) ## ๐Ÿ”— Related Projects - [app-client-base-net](../app-client-base-net) - .NET MAUI cross-platform client - [iam-service-net](../../services/iam-service-net) - Authentication backend ## ๐Ÿ“š Additional Documentation - [Architecture Guide](./architecture.md) - Detailed architecture and design decisions ## ๐Ÿ“„ License Copyright ยฉ 2026 GoodGo. All rights reserved.