Skip to content

πŸ”οΈ iOS hiking app with AI assistant & ML risk assessment built with SwiftUI, Core ML & FoundationModels for intelligent trail safety analysis and expert hiking guidance

License

Notifications You must be signed in to change notification settings

dmakarau/HikeAnalyzer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

22 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

HikeAnalyzer

An iOS app for trail risk assessment. Uses Core ML for predictions and includes an AI chat assistant for hiking advice.

Tech Stack

Swift SwiftUI Core ML FoundationModels Async/Await Foundation

Xcode iOS Educational

Screenshots

Main Screen Analysis Result AI Assistant Risk Levels Guide

Features

AI Hiking Assistant

  • Chat interface for hiking questions and advice
  • Uses Apple's FoundationModels on supported devices (iOS 26+)
  • Falls back to curated knowledge base on older devices
  • Covers gear, safety, weather, and trail planning topics

Risk Assessment

  • Core ML model predicts trail difficulty
  • Takes distance, elevation, terrain, and wildlife into account
  • Shows risk level with personalized recommendations
  • Optional AI-enhanced explanations when available

Risk Categories

  • Easy: Good for beginners
  • Moderate: Some experience recommended
  • Difficult: Requires fitness and experience
  • High Risk: Expert-level trails

Getting Started

Requirements

  • macOS Ventura 13.0+
  • Xcode 15.0+
  • iOS 17.0+ SDK

Installation

  1. Clone the repository

    git clone https://github.com/dmakarau/HikeAnalyzer.git
    cd HikeAnalyzer
  2. Open in Xcode

    open HikeAnalyzer.xcodeproj
  3. Build and Run

    • Select your target device or simulator
    • Press Cmd + R to build and run

Usage

  1. Enter trail details: distance, elevation, terrain type, wildlife danger
  2. Tap "Analyze Trail" to get your risk assessment
  3. Use AI Support for hiking questions and advice
  4. Check Risk Levels Guide to understand the categories

How It Works

AI Assistant

On iOS 26+ devices with FoundationModels support, the chat uses on-device AI. On older devices, it uses a curated knowledge base covering common hiking topics. Both provide the same user experience.

Risk Model

The Core ML model considers:

  • Distance: Longer trails mean more fatigue
  • Elevation: Steep climbs increase difficulty
  • Terrain: Surface type affects stability
  • Wildlife: Potential animal encounters

Design Notes

  • Clean, minimal interface
  • Supports Dynamic Type and VoiceOver
  • Lightweight ML model for fast predictions

Project Structure

HikeAnalyzer/
β”œβ”€β”€ App/                    # App entry point
β”œβ”€β”€ AIChat/                 # AI assistant functionality
β”‚   β”œβ”€β”€ Models/            # Chat message data models
β”‚   β”œβ”€β”€ Services/          # AI service integration
β”‚   β”œβ”€β”€ ViewModels/        # Chat business logic
β”‚   └── Views/             # Chat interface components
β”œβ”€β”€ Core/
β”‚   β”œβ”€β”€ Model/             # Data models and ML integration
β”‚   β”œβ”€β”€ View/              # SwiftUI views
β”‚   └── Modifiers/         # View modifiers and themes
└── Resources/             # Assets and ML model

Key Components

  • CoreMLTrailAnalyzer: ML model wrapper
  • ChatViewModel: Chat state management
  • HikingAIService: FoundationModels + fallback logic
  • TrailTheme: Colors and styling

Contributing

This is a personal project for learning. Feel free to fork it or open an issue if you find bugs.

Changelog

December 2025

  • Added Apple Intelligence integration via FoundationModels (iOS 26+)
  • Fallback system for devices without FoundationModels support
  • AI-enhanced risk explanations and recommendations

Earlier Updates

  • Migrated to @Observable from @ObservableObject
  • MVVM refactoring with ChatViewModel
  • Decomposed views into smaller components
  • Added ChatConstants for string management
  • Keyboard dismissal improvements

License

MIT License - see LICENSE.

Acknowledgments

  • SwiftUI community
  • Apple's Core ML and FoundationModels teams

Built with SwiftUI, Core ML, and FoundationModels.

About

πŸ”οΈ iOS hiking app with AI assistant & ML risk assessment built with SwiftUI, Core ML & FoundationModels for intelligent trail safety analysis and expert hiking guidance

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages