Skip to content

popand/sun-shade

Repository files navigation

Sunshade 🌞

A comprehensive iOS app for UV index monitoring and sun safety, built with SwiftUI. Sunshade helps users stay safe in the sun by providing real-time UV data, personalized recommendations, and exposure tracking.

Features

🌑️ Real-Time UV Monitoring

  • Live UV index data from Apple WeatherKit (iOS 16+)
  • Location-based weather information
  • Current temperature and cloud cover
  • Color-coded UV level indicators (Low, Moderate, High, Very High, Extreme)

⏰ Smart Safety Timer

  • Customizable exposure timers (10-30 minutes)
  • Visual countdown with circular progress indicator
  • Automatic session logging when timer completes

πŸ“Š Exposure Activity Log

  • Detailed tracking of sun exposure sessions
  • Records duration, location, time of day, UV index, and temperature
  • Timeline view showing most recent sessions first
  • Persistent storage across app launches

🌀️ Interactive Weather Forecast

  • Expandable 5-day weather forecast
  • Tanning Quality Indicators - Smart recommendations based on UV index and cloud cover:
    • 🎯 Great: Perfect tanning conditions (UV 8+, low clouds)
    • πŸ‘ Good: Good tanning weather (UV 5-7, some clouds)
    • πŸ‘Œ Fair: Moderate conditions (UV 2-4, mixed clouds)
    • πŸ‘Ž Poor: Not ideal for tanning (UV 0-1, heavy clouds)

πŸ›‘οΈ Personalized Safety Recommendations

  • Safe exposure time calculations based on current UV index
  • Dynamic safety tips and warnings
  • SPF recommendations and reapplication reminders
  • Shade-seeking advice during peak hours

πŸ‘€ User Profile & Personalization

  • Editable user name with personalized greetings
  • Skin type selection for customized recommendations
  • Weekly exposure statistics and session tracking
  • Time-sensitive greetings (Good Morning/Afternoon/Evening)

🎯 Smart Dashboard

  • Clean, intuitive interface with card-based layout
  • Real-time location display with refresh capability
  • UV index card with safe exposure time recommendations
  • Daily progress tracking
  • Pull-to-refresh functionality

Screenshots

Dashboard View

Dashboard

Main dashboard showing UV index, weather conditions, and safety recommendations

Safety Timer

Safety Timer

Customizable safety timer with exposure session logging

Weather Forecast

Weather Forecast

5-day forecast with tanning quality indicators

Profile View

Profile

User profile with statistics and personalization options

Technical Features

Architecture

  • MVVM Pattern: Clean separation of concerns with ObservableObject view models
  • SwiftUI: Modern declarative UI framework
  • Combine Framework: Reactive programming for data flow
  • Core Location: GPS-based location services

APIs & Services

  • Apple WeatherKit: Weather and UV data source (iOS 16+)
  • Location Services: Automatic location detection and reverse geocoding
  • UserDefaults: Persistent storage for user preferences and exposure logs

Data Models

  • WeatherData: Comprehensive weather information with forecast data
  • ExposureSession: Detailed session tracking with environmental context
  • UserProfile: Personalized user settings and preferences
  • TanningQuality: Smart quality assessment system

Setup & Installation

Prerequisites

  • iOS 16.0+ (required for WeatherKit)
  • Xcode 14.0+
  • Apple Developer Account (for WeatherKit)

Configuration

  1. Clone the repository
  2. Open Sunshade.xcodeproj in Xcode
  3. WeatherKit will work automatically with your Apple Developer account
  4. Enable location permissions in your iOS simulator/device
  5. Build and run the project

Weather Service Configuration

WeatherKit (iOS 16+):

  • No configuration needed - uses your Apple Developer account
  • 500,000 free API calls per month
  • No API keys required

App Structure

Sunshade/
β”œβ”€β”€ Models/
β”‚   β”œβ”€β”€ DashboardViewModel.swift    # Main app state management
β”‚   β”œβ”€β”€ WeatherData.swift          # Weather and forecast models
β”‚   β”œβ”€β”€ ExposureLog.swift          # Session tracking models
β”‚   β”œβ”€β”€ UserProfile.swift          # User preferences
β”‚   └── UVLevel.swift              # UV classification
β”œβ”€β”€ Views/
β”‚   β”œβ”€β”€ DashboardView.swift        # Main dashboard
β”‚   β”œβ”€β”€ SafetyTimerView.swift      # Timer and activity log
β”‚   β”œβ”€β”€ WeatherCard.swift          # Expandable weather forecast
β”‚   β”œβ”€β”€ UVIndexCard.swift          # UV monitoring display
β”‚   β”œβ”€β”€ ProfileView.swift          # User profile management
β”‚   └── EducationView.swift        # Sun safety education
β”œβ”€β”€ Services/
β”‚   β”œβ”€β”€ WeatherKitService.swift    # Apple WeatherKit integration
β”‚   └── LocationManager.swift      # GPS and location services
└── Utils/
    β”œβ”€β”€ AppColors.swift            # UI color scheme
    β”œβ”€β”€ TimeUtils.swift            # Time formatting utilities
    └── Configuration.swift        # App configuration

Key Technologies

  • SwiftUI - Modern declarative UI
  • Combine - Reactive programming
  • Core Location - GPS and geocoding
  • URLSession - Network requests
  • UserDefaults - Data persistence
  • Timer - Background timing functionality

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments


Stay safe in the sun! β˜€οΈπŸ§΄

About

🌞 SunSmart - Smart UV monitoring and sun safety iOS app built with SwiftUI. Features real-time UV index tracking, safety timers, exposure logging, weather forecasts with tanning quality indicators, and personalized sun protection recommendations. Stay safe in the sun! β˜€οΈπŸ§΄

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors