# sameersyd/fortunewheel architecture

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

- Interactive diagram: https://gitdiagram.com/sameersyd/fortunewheel
- Repository: https://github.com/sameersyd/fortunewheel

## Overview

FortuneWheel is a SwiftUI library for configuring and displaying a spinning wheel, then reporting the selected title index. The caller supplies titles, appearance, and callbacks through a model; a drag gesture starts the spin, and the view model chooses a stop index, animates, and invokes the completion callback. The wheel view renders labeled colored sectors and uses a separate shape for each sector. The source excerpts show the main calls; optional callback behavior and configuration are also documented in the README.

Main entry points: [`Sources/FortuneWheel/FortuneWheel.swift`](https://github.com/sameersyd/fortunewheel/blob/master/Sources/FortuneWheel/FortuneWheel.swift) (FortuneWheel view), [`Sources/FortuneWheel/FortuneWheelViewModel.swift`](https://github.com/sameersyd/fortunewheel/blob/master/Sources/FortuneWheel/FortuneWheelViewModel.swift) (Spin controller), [`Sources/FortuneWheel/FortuneWheelModel.swift`](https://github.com/sameersyd/fortunewheel/blob/master/Sources/FortuneWheel/FortuneWheelModel.swift) (Wheel configuration), [`Sources/FortuneWheel/SpinWheel/SpinWheelView.swift`](https://github.com/sameersyd/fortunewheel/blob/master/Sources/FortuneWheel/SpinWheel/SpinWheelView.swift) (Sector renderer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Public API"]
  node_model["Wheel configuration"]
  node_wheel["FortuneWheel view<br/>[FortuneWheel.swift]"]
end

subgraph group_spin["Spin Behavior"]
  node_spinlogic["Spin controller"]
end

subgraph group_render["Wheel Rendering"]
  node_wheelview["Sector renderer"]
  node_cell["Sector shape"]
end

node_caller(("App caller"))

node_caller -->|"configures"| node_model
node_caller -->|"creates"| node_wheel
node_wheel -->|"reads settings"| node_model
node_wheel -->|"creates; starts spin"| node_spinlogic
node_wheel -->|"renders"| node_wheelview
node_spinlogic -->|"reads callbacks"| node_model
node_spinlogic -->|"reports index"| node_caller
node_wheelview -->|"draws sectors"| node_cell

click node_model "https://github.com/sameersyd/fortunewheel/blob/master/Sources/FortuneWheel/FortuneWheelModel.swift"
click node_wheel "https://github.com/sameersyd/fortunewheel/blob/master/Sources/FortuneWheel/FortuneWheel.swift"
click node_spinlogic "https://github.com/sameersyd/fortunewheel/blob/master/Sources/FortuneWheel/FortuneWheelViewModel.swift"
click node_wheelview "https://github.com/sameersyd/fortunewheel/blob/master/Sources/FortuneWheel/SpinWheel/SpinWheelView.swift"
click node_cell "https://github.com/sameersyd/fortunewheel/blob/master/Sources/FortuneWheel/SpinWheel/SpinWheelCell.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_model,node_wheel toneBlue
class node_spinlogic toneAmber
class node_wheelview,node_cell toneMint
class node_caller toneIndigo
```

## Components

### Public API

- [Wheel configuration](https://github.com/sameersyd/fortunewheel/blob/master/Sources/FortuneWheel/FortuneWheelModel.swift): `Sources/FortuneWheel/FortuneWheelModel.swift`
- [FortuneWheel view](https://github.com/sameersyd/fortunewheel/blob/master/Sources/FortuneWheel/FortuneWheel.swift): `Sources/FortuneWheel/FortuneWheel.swift`

### Spin Behavior

- [Spin controller](https://github.com/sameersyd/fortunewheel/blob/master/Sources/FortuneWheel/FortuneWheelViewModel.swift): `Sources/FortuneWheel/FortuneWheelViewModel.swift`

### Wheel Rendering

- [Sector renderer](https://github.com/sameersyd/fortunewheel/blob/master/Sources/FortuneWheel/SpinWheel/SpinWheelView.swift): `Sources/FortuneWheel/SpinWheel/SpinWheelView.swift`
- [Sector shape](https://github.com/sameersyd/fortunewheel/blob/master/Sources/FortuneWheel/SpinWheel/SpinWheelCell.swift): `Sources/FortuneWheel/SpinWheel/SpinWheelCell.swift`

### Other components

- **App caller**

## Connections

- App caller → Wheel configuration: configures (evidence: `README.md`)
- App caller → FortuneWheel view: creates (evidence: `README.md`)
- FortuneWheel view → Wheel configuration: reads settings (evidence: `Sources/FortuneWheel/FortuneWheel.swift`)
- FortuneWheel view → Spin controller: creates; starts spin (evidence: `Sources/FortuneWheel/FortuneWheel.swift`)
- FortuneWheel view → Sector renderer: renders (evidence: `Sources/FortuneWheel/FortuneWheel.swift`)
- Spin controller → Wheel configuration: reads callbacks (evidence: `Sources/FortuneWheel/FortuneWheelViewModel.swift`)
- Spin controller → App caller: reports index (evidence: `Sources/FortuneWheel/FortuneWheelViewModel.swift`)
- Sector renderer → Sector shape: draws sectors (evidence: `Sources/FortuneWheel/SpinWheel/SpinWheelView.swift`)
