Skip to content

SimRa iOS - SwiftUI - #83

Open
Lime1887 wants to merge 8 commits into
simra-project:masterfrom
Lime1887:SimRa092026
Open

SimRa iOS - SwiftUI#83
Lime1887 wants to merge 8 commits into
simra-project:masterfrom
Lime1887:SimRa092026

Conversation

@Lime1887

@Lime1887 Lime1887 commented Sep 5, 2026

Copy link
Copy Markdown

Pull Request: SwiftUI Modernization, Core Models, & Live Activities

Overview

This pull request continues the comprehensive modernization of the SimRa iOS application by migrating core Objective-C data models, region managers, and upload systems completely to Swift, while introducing robust Live Activity support, modern SwiftUI navigation structures, updated Bluetooth components, deep iOS system integration, and a redesigned App Icon adhering to the latest Apple design guidelines.


Key Changes & Component Breakdown

1. Model Modernization & Swift Porting

Replaced legacy .h/.m implementation pairs with native Swift classes utilizing @objcMembers to ensure seamless interoperability with remaining Objective-C modules.

  • News.swift: Reimplemented news fetching and version parsing logic, handling network requests via URLSession, response evaluation, and local version persistence.
  • Region.swift & Regions.swift: Converted region management, localization helpers, coordinate handling, and distance calculations into clean Swift, leveraging JSON dataset parsing with safe fallbacks to legacy plist structures.
  • Trip.swift & Related Models: Completely transitioned the heavy trip data layer (Trip.swift, TripModels.swift) from Objective-C to modern Swift structures to improve memory safety and performance during route processing.
  • UploaderObject.swift: Modernized data upload routines, handling multipart/file uploads via URLSession and secure SSL certificate pinning through the Security framework (SecTrustEvaluateWithError).
  • IdPicker.swift: Added a clean SwiftUI component for selection workflows.

2. SwiftUI Views & Architecture Modernization

  • Application Entry (SimRaApp.swift): Migrated the app initialization to the modern SwiftUI @main lifecycle model, integrating WindowGroup, AppDelegate bridging, and custom URL scheme handling (simra://) for deep links.
  • OpenBikeSensor Integration (OBSConfigView.swift & ViewModel): Rewrote the Bluetooth configuration module using a @MainActor-isolated ObservableObject and a reactive CoreBluetooth wrapper to handle asynchronous peripheral discovery and telemetry displays.
  • Floating Action Button (ModernRecordActionButton.swift): Introduced a custom recording action button with advanced SwiftUI styling, spring animations, and native accessibility traits.
  • Interactive Hazard Map (SimRaHazardMapView.swift): Embedded the web-based SimRa hazard map via a performant UIViewRepresentable wrapper around WKWebView with custom navigation delegation.
  • Trip Management & Settings (TripDetailView.swift & TripSettingsView.swift): Converted table layouts into native SwiftUI Form structures supporting unsaved changes tracking via .onChange and persistent preferences via @AppStorage.

3. Live Activity & Dynamic Island Integration (SimRaRecordingActivityManager.swift)

Introduced full support for iOS 16.2+ Live Activities via ActivityKit to display real-time trip metrics on the Lock Screen and Dynamic Island.

  • Lifecycle Management: Manages creation, updating, and immediate dismissal policies for recording sessions (SimRaRecordingAttributes).
  • Route & Hazard Extensions: Added specialized activity updaters (SimRaRecordingActivityManager+Enhanced.swift) to dynamically push live route coordinate buffers and increment recorded hazard counters during active bike rides.

4. Utility Extensions & Charting Modules

  • DSBarChart: Replaced legacy Quartz-based charting with a lightweight SwiftUI bar chart component featuring automatic data scaling and conditional color gradient rendering.
  • String Hashing (NSString+hashCode.swift): Implements a Swift extension replicating Java/Objective-C UTF-16 string hashing algorithms for consistent backend client identifier generation.
  • Time Formatting (NSTimeInterval+hms.swift): Adds clean formatting extensions to TimeInterval for structured human-readable duration outputs.

Technical Notes & Architectural Decisions

  • Interoperability: Retained @objc and @objcMembers attributes on migrated model classes to prevent breaking integration points with existing legacy database controllers or delegates.
  • Concurrency: Ensured thread safety for UI-bound live activity updates and Bluetooth stack communication by annotating managers with @MainActor and leveraging async/await.
image image IMG_2248 IMG_2247

lliimmee-lime and others added 8 commits August 25, 2026 18:22
Co-authored-by: Cursor <cursoragent@cursor.com>
…trip tracking

- Migrate core models, views, and managers to Swift
- Add Live Activities and SwiftUI widgets for active trip monitoring
- Implement AppIntents and Siri shortcut integration for recording control
- Add interactive user hazard tracking during rides and map route visualization
- Clean up framework caches and obsolete bridging headers
…trip tracking

- Migrate core models, views, and managers to Swift
- Add Live Activities and SwiftUI widgets for active trip monitoring
- Implement AppIntents and Siri shortcut integration for recording control
- Add interactive user hazard tracking during rides and map route visualization
- Clean up framework caches and obsolete bridging headers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants