Bedrud Documentation

L’application iOS Bedrud est construite avec SwiftUI, offrant une expérience native de réunion vidéo avec multi-instance support et secure credential storage.

Technology Stack

TechnologieVersionObjectif
Swift5.9+Langage
SwiftUILatestUI framework
LiveKit Swift SDK2.0+WebRTC media
KeychainAccess4.2.2+Secure credential storage

Deployment target : iOS 18.0

Project Configuration

Le projet utilise XCodeGen pour la project generation à partir de project.yml :

  • Bundle ID : com.bedrud.ios
  • Généré avec : xcodegen generate

Directory Structure

apps/ios/Bedrud/
├── BedrudApp.swift                # App entry point
├── Core/
│   ├── API/
│   │   └── APIClient.swift        # URLSession-based REST client
│   ├── Auth/
│   │   └── AuthManager.swift      # Token management, login/logout
│   ├── Instance/
│   │   ├── InstanceManager.swift  # Central multi-instance orchestrator
│   │   └── InstanceStore.swift    # Persistent instance storage (UserDefaults)
│   └── LiveKit/
│       └── RoomManager.swift      # LiveKit room connection manager
├── Features/
│   ├── Auth/
│   │   ├── LoginView.swift        # Login screen
│   │   └── RegisterView.swift     # Registration screen
│   ├── Dashboard/
│   │   └── DashboardView.swift    # Room list et management
│   ├── Meeting/
│   │   └── MeetingView.swift      # Video call interface
│   ├── Profile/
│   │   └── ProfileView.swift      # User profile
│   ├── Instance/
│   │   ├── AddInstanceView.swift  # Add server instance
│   │   └── InstanceSwitcherView.swift  # Switch between instances
│   ├── Settings/
│   │   └── SettingsView.swift     # App settings
│   ├── JoinByURL/
│   │   └── JoinByURLView.swift    # Deep link handling
│   └── Main/
│       └── MainTabView.swift      # Tab navigation
├── Models/
│   ├── User.swift
│   ├── Room.swift
│   └── Instance.swift
└── Design/
    └── Components/                # Reusable SwiftUI components

Multi-Instance Architecture

L’application iOS reflète l’architecture Android pour le multi-instance support.

flowchart TB
    subgraph InstanceManager [InstanceManager ObservableObject]
        direction TB
        instances["instances: [Instance]"]
        activeInstance["activeInstance"]
        authManager["authManager"]
        apiClient["apiClient"]
        roomManager["roomManager"]
        others["..."]
        
        instances --- activeInstance
        activeInstance --- authManager
        authManager --- apiClient
        apiClient --- roomManager
        roomManager --- others
    end
    style InstanceManager fill:#f0f0f0,stroke:#333

Key Pattern

Les dépendances sont @Published properties sur InstanceManager, qui est un ObservableObject. Les vues le reçoivent via @EnvironmentObject :

struct DashboardView: View {
    @EnvironmentObject var instanceManager: InstanceManager
 
    var body: some View {
        if let authManager = instanceManager.authManager {
            // Render authenticated UI
        }
    }
}
flowchart LR
    NoInstances["No instances"] --> AddInstanceView
    HasInstancesNotLogged["Has instances,<br>not logged in"] --> LoginView
    HasInstancesLogged["Has instances,<br>logged in"] --> DashboardView
    DashboardView -. "toolbar sheet" .-> InstanceSwitcherView["InstanceSwitcherView"]

L’instance switcher apparaît comme un .sheet déclenché depuis le Dashboard toolbar.

App Entry Point

BedrudApp.swift initialise les core services et les injecte dans le SwiftUI environment :

@main
struct BedrudApp: App {
    @StateObject var instanceStore = InstanceStore()
    @StateObject var instanceManager = InstanceManager()
    @StateObject var settingsStore = SettingsStore()
 
    var body: some Scene {
        WindowGroup {
            ContentView()
                .environmentObject(instanceStore)
                .environmentObject(instanceManager)
                .environmentObject(settingsStore)
        }
    }
}

Features

Secure Storage

Utilise KeychainAccess pour stocker les JWT tokens et les sensitive credentials, plutôt que UserDefaults.

Deep Linking

Gère les URLs pour direct room joining et room codes.

Settings

Les user preferences sont persistantes via SettingsStore en utilisant UserDefaults.

Building

# Ouvrir dans Xcode
make dev-ios
 
# Build archive (Release)
make build-ios
 
# Export IPA (requiert ExportOptions.plist)
make export-ios
 
# Build pour le simulator (Debug)
make build-ios-sim

Requirements

  • Xcode (dernière version stable)
  • iOS 18.0 deployment target
  • Pour les device builds : Apple Developer account et provisioning profile