# lavsdcoder/bmi-calculator-ios13 architecture

> Architecture diagram of the GitHub repository lavsdcoder/bmi-calculator-ios13, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lavsdcoder/bmi-calculator-ios13
- Repository: https://github.com/lavsdcoder/bmi-calculator-ios13

## Overview

##### Project type and purpose
- This is an iOS mobile app built in Swift, following the MVC pattern.
- It calculates Body Mass Index (BMI) based on user input, then displays health advice.

##### File structure
- Top-level Xcode project files (BMI Calculator.xcodeproj) define build settings, schemes, and workspaces.
- The “BMI Calculator” folder contains:
– AppDelegate.swift + SceneDelegate.swift: the application lifecycle entry points.
– Controllers/: CalculateViewController.swift and ResultViewController.swift implement the UI logic.
– Models/: BMI.swift and CalculatorBrain.swift encapsulate data and business logic.
– Views/ + Base.lproj/Main.storyboard: UI definitions for the two screens.
- Info.plist configures app metadata and permissions.

##### Extract architecture insights from the README
- The app is explicitly designed to teach MVC, Optionals, classes vs. structs.
- Two screens are navigated with animation: a data entry screen and a results screen.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "OS/Framework"
        UIKit["UIKit Framework"]:::osFramework
    end

    subgraph "App Lifecycle"
        AppDelegate["AppDelegate"]:::lifecycle
        SceneDelegate["SceneDelegate"]:::lifecycle
    end

    subgraph "Metadata"
        InfoPlist["Info.plist"]:::metadata
    end

    subgraph "Views/Storyboards"
        LaunchSB["LaunchScreen.storyboard"]:::views
        MainSB["Main.storyboard"]:::views
    end

    subgraph "Controllers"
        CalcVC["CalculateViewController"]:::controllers
        ResultVC["ResultViewController"]:::controllers
    end

    subgraph "Models"
        CalcBrain["CalculatorBrain"]:::models
        BMIMod["BMI Model"]:::models
    end

    subgraph "Assets"
        AssetsCat["Assets.xcassets"]:::assets
    end

    InfoPlist --> AppDelegate
    AppDelegate --> SceneDelegate
    SceneDelegate --> LaunchSB
    SceneDelegate --> MainSB
    AssetsCat --> LaunchSB
    AssetsCat --> MainSB
    MainSB --> CalcVC
    CalcVC -->|"calculateBMI()"| CalcBrain
    CalcBrain -->|"returns BMI instance"| BMIMod
    CalcVC -->|"segueWithIdentifier"| ResultVC
    ResultVC -->|"reads BMI & advice"| BMIMod

    click AppDelegate "https://github.com/lavsdcoder/bmi-calculator-ios13/blob/main/BMI Calculator/AppDelegate.swift"
    click SceneDelegate "https://github.com/lavsdcoder/bmi-calculator-ios13/blob/main/BMI Calculator/SceneDelegate.swift"
    click LaunchSB "https://github.com/lavsdcoder/bmi-calculator-ios13/blob/main/BMI Calculator/Base.lproj/LaunchScreen.storyboard"
    click MainSB "https://github.com/lavsdcoder/bmi-calculator-ios13/blob/main/BMI Calculator/Views/Base.lproj/Main.storyboard"
    click CalcVC "https://github.com/lavsdcoder/bmi-calculator-ios13/blob/main/BMI Calculator/Controllers/CalculateViewController.swift"
    click ResultVC "https://github.com/lavsdcoder/bmi-calculator-ios13/blob/main/BMI Calculator/Controllers/ResultViewController.swift"
    click CalcBrain "https://github.com/lavsdcoder/bmi-calculator-ios13/blob/main/BMI Calculator/Models/CalculatorBrain.swift"
    click BMIMod "https://github.com/lavsdcoder/bmi-calculator-ios13/blob/main/BMI Calculator/Models/BMI.swift"
    click AssetsCat "https://github.com/lavsdcoder/bmi-calculator-ios13/blob/main/BMI Calculator/Assets.xcassets"
    click InfoPlist "https://github.com/lavsdcoder/bmi-calculator-ios13/blob/main/BMI Calculator/Info.plist"

    classDef osFramework fill:#CCCCCC,stroke:#333,stroke-width:1px
    classDef lifecycle fill:#AED6F1,stroke:#333,stroke-width:1px
    classDef controllers fill:#85C1E9,stroke:#333,stroke-width:1px
    classDef models fill:#ABEBC6,stroke:#333,stroke-width:1px
    classDef views fill:#F9E79F,stroke:#333,stroke-width:1px
    classDef assets fill:#F5CBA7,stroke:#333,stroke-width:1px
    classDef metadata fill:#F5B7B1,stroke:#333,stroke-width:1px
```
