# reukix/reloc architecture

> Architecture diagram of the GitHub repository reukix/reloc, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/reukix/reloc
- Repository: https://github.com/reukix/reloc

## Overview

Reloc is an iOS/iPadOS app that simulates an accessory GPS by sending location as NMEA through a local virtual accessory. The main workflow is to choose or search for a place, configure a fixed point or route, start a session, and have the accessory session stream updates for iOS to consume; the app also monitors CoreLocation to report whether injection took effect. Distinct branches cover routes and GPX, joystick roaming, favorites, refresh and background support, automation, maps, and diagnostics. Several subsystem details are documented but not shown in source excerpts, so those links are omitted or identified as documented.

Main entry points: [`Reloc/Core/Swift/RelocViewModel.swift`](https://github.com/reukix/reloc/blob/main/Reloc/Core/Swift/RelocViewModel.swift) (Session coordinator), [`Reloc/Core/Swift/AccessoryLocationSession.swift`](https://github.com/reukix/reloc/blob/main/Reloc/Core/Swift/AccessoryLocationSession.swift) (Accessory session), [`Reloc/UI/MapPickerView.swift`](https://github.com/reukix/reloc/blob/main/Reloc/UI/MapPickerView.swift) (Map and location picker), [`Reloc/UI/RelocApp.swift`](https://github.com/reukix/reloc/blob/main/Reloc/UI/RelocApp.swift) (App shell)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["App interaction"]
  node_app["App shell<br/>[RelocApp.swift]"]
  node_map["Map and location picker"]
  node_map_tiles["Global tile maps"]
  node_configuration["Configuration"]
  node_anti_snapback["Proxy rule export"]
end

subgraph group_location["Location workflows"]
  node_place_search["Place search"]
  node_view_model["Session coordinator"]
  node_trajectory["Route simulation"]
  node_gpx["GPX import/export<br/>[GPXCodec.swift]"]
  node_favorites["Favorites and routes<br/>[PlacesSheet.swift]"]
  node_favorite_editor["Favorite editor"]
  node_joystick["Joystick roaming"]
end

subgraph group_injection["Accessory injection"]
  node_accessory_session["Accessory session"]
  node_iap2["iAP2 link<br/>[IAP2Link.swift]"]
  node_nmea["NMEA generation"]
  node_virtual_accessory["Virtual accessory transport"]
  node_signer["MFi signing<br/>[RLMFiSigner.m]"]
end

subgraph group_support["Monitoring and support"]
  node_core_location["CoreLocation monitor"]
  node_refresh["Location refresh"]
  node_keep_alive["Background keep-alive"]
  node_intents["Shortcuts and URLs"]
  node_protocol_logs["Telemetry and logs"]
end

node_user(("User"))
node_external_maps(("Apple Maps and OSM"))
node_ios_location(("iOS CoreLocation"))

node_user -->|"opens"| node_app
node_app -->|"presents"| node_map
node_app -->|"presents"| node_configuration
node_app -->|"presents"| node_protocol_logs
node_user -->|"selects location"| node_map
node_map -->|"updates"| node_view_model
node_map -->|"searches"| node_place_search
node_place_search -.->|"queries fallback"| node_external_maps
node_map -->|"renders tiles"| node_map_tiles
node_map -->|"opens places"| node_favorites
node_favorites -->|"selects saved item"| node_view_model
node_favorites -->|"edits favorite"| node_favorite_editor
node_user -.->|"manages saved items"| node_favorites
node_view_model -->|"imports and exports"| node_gpx
node_view_model -->|"plans route"| node_trajectory
node_user -.->|"steers"| node_joystick
node_view_model -->|"starts session"| node_accessory_session
node_accessory_session -->|"advances route"| node_trajectory
node_accessory_session -->|"gets roaming target"| node_joystick
node_accessory_session -->|"generates sentences"| node_nmea
node_accessory_session -->|"uses link"| node_iap2
node_accessory_session -.->|"opens transport"| node_virtual_accessory
node_iap2 -.->|"uses transport"| node_virtual_accessory
node_accessory_session -.->|"authenticates"| node_signer
node_virtual_accessory -.->|"sends NMEA"| node_ios_location
node_view_model -->|"checks injection"| node_core_location
node_core_location -.->|"reports status"| node_view_model
node_view_model -->|"controls refresh"| node_refresh
node_view_model -->|"coordinates background"| node_keep_alive
node_intents -->|"starts or stops"| node_view_model
node_configuration -->|"changes settings"| node_view_model
node_configuration -->|"presents rules"| node_anti_snapback
node_protocol_logs -->|"reads events"| node_view_model
node_protocol_logs -->|"shows telemetry"| node_core_location
node_map -.->|"uses MapKit search"| node_external_maps

click node_app "https://github.com/reukix/reloc/blob/main/Reloc/UI/RelocApp.swift"
click node_map "https://github.com/reukix/reloc/blob/main/Reloc/UI/MapPickerView.swift"
click node_map_tiles "https://github.com/reukix/reloc/blob/main/Reloc/UI/WebMercatorMapView.swift"
click node_place_search "https://github.com/reukix/reloc/blob/main/Reloc/Core/Swift/NominatimSearchClient.swift"
click node_view_model "https://github.com/reukix/reloc/blob/main/Reloc/Core/Swift/RelocViewModel.swift"
click node_trajectory "https://github.com/reukix/reloc/blob/main/Reloc/Core/Swift/TrajectoryEngine.swift"
click node_gpx "https://github.com/reukix/reloc/blob/main/Reloc/Core/Swift/GPXCodec.swift"
click node_favorites "https://github.com/reukix/reloc/blob/main/Reloc/UI/PlacesSheet.swift"
click node_favorite_editor "https://github.com/reukix/reloc/blob/main/Reloc/UI/FavoriteEditorSheet.swift"
click node_joystick "https://github.com/reukix/reloc/blob/main/Reloc/Core/Swift/JoystickDriver.swift"
click node_accessory_session "https://github.com/reukix/reloc/blob/main/Reloc/Core/Swift/AccessoryLocationSession.swift"
click node_iap2 "https://github.com/reukix/reloc/blob/main/Reloc/Core/Swift/IAP2Link.swift"
click node_nmea "https://github.com/reukix/reloc/blob/main/Reloc/Core/Swift/NMEAGenerator.swift"
click node_virtual_accessory "https://github.com/reukix/reloc/blob/main/Reloc/Core/ObjC/RLVirtualAccessoryTransport.m"
click node_signer "https://github.com/reukix/reloc/blob/main/Reloc/Core/ObjC/RLMFiSigner.m"
click node_core_location "https://github.com/reukix/reloc/blob/main/Reloc/Core/Swift/LiveCoreLocationMonitor.swift"
click node_refresh "https://github.com/reukix/reloc/blob/main/Reloc/Core/Swift/LocationRefreshPresenter.swift"
click node_keep_alive "https://github.com/reukix/reloc/blob/main/Reloc/Core/Swift/BackgroundKeepAlive.swift"
click node_intents "https://github.com/reukix/reloc/blob/main/Reloc/Core/Swift/RelocAppIntents.swift"
click node_configuration "https://github.com/reukix/reloc/blob/main/Reloc/UI/ConfigurationView.swift"
click node_anti_snapback "https://github.com/reukix/reloc/blob/main/Reloc/UI/AntiSnapbackRulesSheet.swift"
click node_protocol_logs "https://github.com/reukix/reloc/blob/main/Reloc/UI/ProtocolLogsView.swift"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_map,node_map_tiles,node_configuration,node_anti_snapback,node_user toneBlue
class node_place_search,node_view_model,node_trajectory,node_gpx,node_favorites,node_favorite_editor,node_joystick toneAmber
class node_accessory_session,node_iap2,node_nmea,node_virtual_accessory,node_signer toneMint
class node_core_location,node_refresh,node_keep_alive,node_intents,node_protocol_logs toneRose
class node_external_maps,node_ios_location toneIndigo
```

## Components

### App interaction

- [App shell](https://github.com/reukix/reloc/blob/main/Reloc/UI/RelocApp.swift): `Reloc/UI/RelocApp.swift`
- [Map and location picker](https://github.com/reukix/reloc/blob/main/Reloc/UI/MapPickerView.swift): `Reloc/UI/MapPickerView.swift`
- [Global tile maps](https://github.com/reukix/reloc/blob/main/Reloc/UI/WebMercatorMapView.swift): `Reloc/UI/WebMercatorMapView.swift`
- [Configuration](https://github.com/reukix/reloc/blob/main/Reloc/UI/ConfigurationView.swift): `Reloc/UI/ConfigurationView.swift`
- [Proxy rule export](https://github.com/reukix/reloc/blob/main/Reloc/UI/AntiSnapbackRulesSheet.swift): `Reloc/UI/AntiSnapbackRulesSheet.swift`

### Location workflows

- [Place search](https://github.com/reukix/reloc/blob/main/Reloc/Core/Swift/NominatimSearchClient.swift): `Reloc/Core/Swift/NominatimSearchClient.swift`
- [Session coordinator](https://github.com/reukix/reloc/blob/main/Reloc/Core/Swift/RelocViewModel.swift): `Reloc/Core/Swift/RelocViewModel.swift`
- [Route simulation](https://github.com/reukix/reloc/blob/main/Reloc/Core/Swift/TrajectoryEngine.swift): `Reloc/Core/Swift/TrajectoryEngine.swift`
- [GPX import/export](https://github.com/reukix/reloc/blob/main/Reloc/Core/Swift/GPXCodec.swift): `Reloc/Core/Swift/GPXCodec.swift`
- [Favorites and routes](https://github.com/reukix/reloc/blob/main/Reloc/UI/PlacesSheet.swift): `Reloc/UI/PlacesSheet.swift`
- [Favorite editor](https://github.com/reukix/reloc/blob/main/Reloc/UI/FavoriteEditorSheet.swift): `Reloc/UI/FavoriteEditorSheet.swift`
- [Joystick roaming](https://github.com/reukix/reloc/blob/main/Reloc/Core/Swift/JoystickDriver.swift): `Reloc/Core/Swift/JoystickDriver.swift`

### Accessory injection

- [Accessory session](https://github.com/reukix/reloc/blob/main/Reloc/Core/Swift/AccessoryLocationSession.swift): `Reloc/Core/Swift/AccessoryLocationSession.swift`
- [iAP2 link](https://github.com/reukix/reloc/blob/main/Reloc/Core/Swift/IAP2Link.swift): `Reloc/Core/Swift/IAP2Link.swift`
- [NMEA generation](https://github.com/reukix/reloc/blob/main/Reloc/Core/Swift/NMEAGenerator.swift): `Reloc/Core/Swift/NMEAGenerator.swift`
- [Virtual accessory transport](https://github.com/reukix/reloc/blob/main/Reloc/Core/ObjC/RLVirtualAccessoryTransport.m): `Reloc/Core/ObjC/RLVirtualAccessoryTransport.m`
- [MFi signing](https://github.com/reukix/reloc/blob/main/Reloc/Core/ObjC/RLMFiSigner.m): `Reloc/Core/ObjC/RLMFiSigner.m`

### Monitoring and support

- [CoreLocation monitor](https://github.com/reukix/reloc/blob/main/Reloc/Core/Swift/LiveCoreLocationMonitor.swift): `Reloc/Core/Swift/LiveCoreLocationMonitor.swift`
- [Location refresh](https://github.com/reukix/reloc/blob/main/Reloc/Core/Swift/LocationRefreshPresenter.swift): `Reloc/Core/Swift/LocationRefreshPresenter.swift`
- [Background keep-alive](https://github.com/reukix/reloc/blob/main/Reloc/Core/Swift/BackgroundKeepAlive.swift): `Reloc/Core/Swift/BackgroundKeepAlive.swift`
- [Shortcuts and URLs](https://github.com/reukix/reloc/blob/main/Reloc/Core/Swift/RelocAppIntents.swift): `Reloc/Core/Swift/RelocAppIntents.swift`
- [Telemetry and logs](https://github.com/reukix/reloc/blob/main/Reloc/UI/ProtocolLogsView.swift): `Reloc/UI/ProtocolLogsView.swift`

### Other components

- **User**
- **Apple Maps and OSM**
- **iOS CoreLocation**

## Connections

- User → App shell: opens (evidence: `Reloc/UI/RelocApp.swift`)
- App shell → Map and location picker: presents (evidence: `Reloc/UI/RelocApp.swift`)
- App shell → Configuration: presents (evidence: `Reloc/UI/RelocApp.swift`)
- App shell → Telemetry and logs: presents (evidence: `Reloc/UI/RelocApp.swift`)
- User → Map and location picker: selects location (evidence: `Reloc/UI/MapPickerView.swift`)
- Map and location picker → Session coordinator: updates (evidence: `Reloc/UI/MapPickerView.swift`)
- Map and location picker → Place search: searches (evidence: `Reloc/UI/MapPickerView.swift`)
- Place search → Apple Maps and OSM: queries fallback (evidence: `Reloc/Core/Swift/NominatimSearchClient.swift`)
- Map and location picker → Global tile maps: renders tiles (evidence: `Reloc/UI/MapPickerView.swift`)
- Map and location picker → Favorites and routes: opens places (evidence: `Reloc/UI/MapPickerView.swift`)
- Favorites and routes → Session coordinator: selects saved item (evidence: `Reloc/UI/PlacesSheet.swift`)
- Favorites and routes → Favorite editor: edits favorite (evidence: `Reloc/UI/PlacesSheet.swift`)
- User → Favorites and routes: manages saved items (evidence: `README.md`)
- Session coordinator → GPX import/export: imports and exports (evidence: `Reloc/Core/Swift/RelocViewModel.swift`)
- Session coordinator → Route simulation: plans route (evidence: `Reloc/Core/Swift/RelocViewModel.swift`)
- User → Joystick roaming: steers (evidence: `README.md`)
- Session coordinator → Accessory session: starts session (evidence: `Reloc/Core/Swift/RelocViewModel.swift`)
- Accessory session → Route simulation: advances route (evidence: `Reloc/Core/Swift/AccessoryLocationSession.swift`)
- Accessory session → Joystick roaming: gets roaming target (evidence: `Reloc/Core/Swift/AccessoryLocationSession.swift`)
- Accessory session → NMEA generation: generates sentences (evidence: `Reloc/Core/Swift/AccessoryLocationSession.swift`)
- Accessory session → iAP2 link: uses link (evidence: `Reloc/Core/Swift/AccessoryLocationSession.swift`)
- Accessory session → Virtual accessory transport: opens transport (evidence: `README.md`)
- iAP2 link → Virtual accessory transport: uses transport (evidence: `README.md`)
- Accessory session → MFi signing: authenticates (evidence: `README.md`)
- Virtual accessory transport → iOS CoreLocation: sends NMEA (evidence: `README.md`)
- Session coordinator → CoreLocation monitor: checks injection (evidence: `Reloc/Core/Swift/RelocViewModel.swift`)
- CoreLocation monitor → Session coordinator: reports status (evidence: `README.md`)
- Session coordinator → Location refresh: controls refresh (evidence: `Reloc/Core/Swift/RelocViewModel.swift`)
- Session coordinator → Background keep-alive: coordinates background (evidence: `Reloc/Core/Swift/RelocViewModel.swift`)
- Shortcuts and URLs → Session coordinator: starts or stops (evidence: `Reloc/Core/Swift/RelocAppIntents.swift`)
- Configuration → Session coordinator: changes settings (evidence: `Reloc/UI/ConfigurationView.swift`)
- Configuration → Proxy rule export: presents rules (evidence: `Reloc/UI/ConfigurationView.swift`)
- Telemetry and logs → Session coordinator: reads events (evidence: `Reloc/UI/ProtocolLogsView.swift`)
- Telemetry and logs → CoreLocation monitor: shows telemetry (evidence: `Reloc/UI/ProtocolLogsView.swift`)
- Map and location picker → Apple Maps and OSM: uses MapKit search (evidence: `README.md`)
