A SwiftUI iOS application for identifying plants by their leaves and assessing plant health. Point your camera at a leaf, and LeafLens will tell you what plant it is and how healthy it looks.
- Live Camera Capture — Real-time camera preview with permission handling
- Plant Identification — Integrates with Plant.id API for species recognition
- Health Assessment — Analyzes plant condition (good / caution / poor)
- Care Plans — Generates step-by-step care recommendations
- Dark Mode Support — Full light/dark theme support via Verdant design system
Capture → Scan → Result → Care
- Capture — Take or select a photo of a leaf
- Scan — AI analysis in progress with loading states and error handling
- Result — Identified plant with confidence score, health status, and one-tap action
- Care — Numbered care timeline with personalized recommendations
LeafLens-iOS/
├── LeafLensApp.swift — App entry point
├── RootView.swift — Flow state machine (4-screen navigation)
├── Info.plist — Camera permission + font registration
├── Theme/
│ ├── VerdantTheme.swift — Color palettes (light/dark) + typography
│ └── Color+Hex.swift — Color(hex:) convenience initializer
├── Models/
│ ├── Plant.swift — Plant data model + CareStep
│ └── HealthStatus.swift — Health enum + display bundles
├── Services/
│ ├── PlantDetectionService.swift — Detection protocol + mock implementation
│ ├── PlantIdService.swift — Plant.id v3 API integration
│ └── CameraController.swift — AVCaptureSession wrapper
└── Views/
├── CaptureView.swift — Camera preview + permission UI
├── ScanView.swift — Analysis progress + retry states
├── ResultView.swift — Plant hero card + health summary
├── CareView.swift — Care timeline
└── Components/
├── LeafPlate.swift — Striped photo placeholder
├── TrafficLight.swift — 3-lamp health badge
├── HealthBlock.swift — Health display variants
└── CameraPreview.swift — UIViewRepresentable preview
- iOS 17+
- Xcode 15+
- Swift 5.9+
- Plant.id API key (for production identification)
git clone <repo-url>
cd leafsnap-appCreate a new SwiftUI iOS app project in Xcode, then drag the contents of LeafLens-iOS/ into your project.
Add DM Serif Display (Regular + Italic) to your bundle:
- Drop the
.ttffiles into the project - Register them under
UIAppFontsinInfo.plist - The app falls back to system fonts if DM Serif is unavailable
The app works out-of-the-box with mock data for testing. To enable real plant identification:
- Sign up at Plant.id for an API key
- Replace the mock detector in
LeafLensApp.swift:
let apiKey = "your-api-key" // Use Keychain or remote config in production
let detector = PlantIdService(apiKey: apiKey)
StateObject(wrappedValue: FlowModel(detector: detector))Security note: Never ship API keys in your binary. Use a backend proxy or remote configuration.
- MVVM Pattern —
FlowModelowns navigation state; views are dumb and previewable - Protocol-Oriented Services —
PlantDetectionServiceprotocol makes swapping APIs trivial - Theme System — All colors and typography centralized in
VerdantTheme - SwiftUI Native — Uses
.task,.animation,@StateObject, and other modern APIs
- Photo library picker is not yet implemented (library button in CaptureView is a no-op)
- Front camera switching is not yet implemented
- Share button on ResultView is not yet implemented
- Care plan steps are currently hardcoded (should derive from detection results)
- Push notifications for recheck reminders are not yet scheduled
Private repository — all rights reserved.
- Plant identification powered by Plant.id
- Design system: Verdant