# sourcelocation/airtroller architecture

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

- Interactive diagram: https://gitdiagram.com/sourcelocation/airtroller
- Repository: https://github.com/sourcelocation/airtroller

## Overview

AirTroller is an iOS app that discovers nearby AirDrop devices, lets the user choose recipients and an image, then manages repeated sender operations and cancellation. The sampled controller and UI show the main workflow; Sharing.swift dynamically binds to Apple’s private Sharing framework. Framework-to-callback edges reflect the registered callbacks in the sampled source.

Main entry points: [`AirTroller/trolldrop/TrollController.swift`](https://github.com/sourcelocation/airtroller/blob/main/AirTroller/trolldrop/TrollController.swift) (Troll controller), [`AirTroller/ContentView.swift`](https://github.com/sourcelocation/airtroller/blob/main/AirTroller/ContentView.swift) (Main screen), [`AirTroller/Misc/ImagePickerView.swift`](https://github.com/sourcelocation/airtroller/blob/main/AirTroller/Misc/ImagePickerView.swift) (Image picker), [`AirTroller/trolldrop/Sharing.swift`](https://github.com/sourcelocation/airtroller/blob/main/AirTroller/trolldrop/Sharing.swift) (Sharing bindings)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interface"]
  node_app["App entry"]
  node_view["Main screen<br/>[ContentView.swift]"]
  node_picker["Image picker"]
  node_alerts["Alerts<br/>[Alert.swift]"]
end

subgraph group_airdrop["AirDrop control"]
  node_controller["Troll controller"]
  node_bindings["Sharing bindings<br/>[Sharing.swift]"]
end

subgraph group_platform["Platform services"]
  node_browser["Device browser"]
  node_operation["Sender operation"]
end

node_user(("User"))
node_nearby(("Nearby devices"))
node_receiver(("Receiving device"))
node_photos["Photo library"]

node_user -->|"uses"| node_view
node_app -->|"presents"| node_view
node_view -->|"starts discovery"| node_controller
node_view -->|"opens"| node_picker
node_picker -->|"loads image"| node_photos
node_picker -->|"returns file URL"| node_view
node_view -->|"requests confirmation"| node_alerts
node_view -->|"starts or stops"| node_controller
node_controller -->|"calls bindings"| node_bindings
node_bindings -->|"loads browser API"| node_browser
node_browser -->|"calls browser callback"| node_controller
node_controller -->|"opens and queries"| node_browser
node_browser -->|"discovers"| node_nearby
node_view -->|"passes image and selection"| node_controller
node_controller -->|"creates and resumes"| node_operation
node_operation -->|"sends AirDrop request"| node_receiver
node_operation -->|"calls operation callback"| node_controller
node_controller -->|"cancels or resumes"| node_operation
node_controller -->|"reports events and people"| node_view

click node_app "https://github.com/sourcelocation/airtroller/blob/main/AirTroller/AirTrollerApp.swift"
click node_view "https://github.com/sourcelocation/airtroller/blob/main/AirTroller/ContentView.swift"
click node_picker "https://github.com/sourcelocation/airtroller/blob/main/AirTroller/Misc/ImagePickerView.swift"
click node_alerts "https://github.com/sourcelocation/airtroller/blob/main/AirTroller/Misc/Alert.swift"
click node_controller "https://github.com/sourcelocation/airtroller/blob/main/AirTroller/trolldrop/TrollController.swift"
click node_bindings "https://github.com/sourcelocation/airtroller/blob/main/AirTroller/trolldrop/Sharing.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_view,node_picker,node_alerts,node_user toneBlue
class node_controller,node_bindings toneAmber
class node_browser,node_operation toneMint
class node_nearby,node_receiver,node_photos toneIndigo
```

## Components

### User interface

- [App entry](https://github.com/sourcelocation/airtroller/blob/main/AirTroller/AirTrollerApp.swift): `AirTroller/AirTrollerApp.swift`
- [Main screen](https://github.com/sourcelocation/airtroller/blob/main/AirTroller/ContentView.swift): `AirTroller/ContentView.swift`
- [Image picker](https://github.com/sourcelocation/airtroller/blob/main/AirTroller/Misc/ImagePickerView.swift): `AirTroller/Misc/ImagePickerView.swift`
- [Alerts](https://github.com/sourcelocation/airtroller/blob/main/AirTroller/Misc/Alert.swift): `AirTroller/Misc/Alert.swift`

### AirDrop control

- [Troll controller](https://github.com/sourcelocation/airtroller/blob/main/AirTroller/trolldrop/TrollController.swift): `AirTroller/trolldrop/TrollController.swift`
- [Sharing bindings](https://github.com/sourcelocation/airtroller/blob/main/AirTroller/trolldrop/Sharing.swift): `AirTroller/trolldrop/Sharing.swift`

### Platform services

- **Device browser**
- **Sender operation**

### Other components

- **User**
- **Nearby devices**
- **Receiving device**
- **Photo library**

## Connections

- User → Main screen: uses
- App entry → Main screen: presents
- Main screen → Troll controller: starts discovery
- Main screen → Image picker: opens
- Image picker → Photo library: loads image
- Image picker → Main screen: returns file URL
- Main screen → Alerts: requests confirmation
- Main screen → Troll controller: starts or stops
- Troll controller → Sharing bindings: calls bindings
- Sharing bindings → Device browser: loads browser API
- Device browser → Troll controller: calls browser callback
- Troll controller → Device browser: opens and queries
- Device browser → Nearby devices: discovers
- Main screen → Troll controller: passes image and selection
- Troll controller → Sender operation: creates and resumes
- Sender operation → Receiving device: sends AirDrop request
- Sender operation → Troll controller: calls operation callback
- Troll controller → Sender operation: cancels or resumes
- Troll controller → Main screen: reports events and people
