reSPF

scientific sunscreen reapplication timer app

Overview

reSPF is a scientific sunscreen reapplication timer app developed as a group project at the Apple Developer Academy. The app computes personalized reapplication intervals based on real-time UV exposure, user activity, and sunscreen properties.

Problem

Most sunscreen reminders rely on fixed time intervals (e.g. every two hours), ignoring changes in UV intensity, weather, activity level, and sunscreen effectiveness. This leads to under-protection, over-application, and environmental harm.

Solution

reSPF introduces a dynamic, exposure-based reapplication timer that adapts continuously based on environmental conditions and user behavior rather than static assumptions.

Features

Smart Reapplication Timer

Calculates a personalized countdown timer based on UV index, SPF level, skin type, and application amount. The timer updates dynamically to reflec t changing conditions.

Sunscreen Collection & SPF Awareness

Users can select and manage the sunscreen product they are using, including SPF levels. This enables the timer to account for different sunscreen effectiveness instead of treating all products the same

Real Time UV Index & Forecast

Displays the current UV index along with upcoming UV levels, allowing the app to dynamically adjust reapplication timing based on real environmental conditions rather than static assumptions.

Cross-Device Experience

Supports Apple Watch integration for quick, glanceable reminders and timely notifications, ensuring users don't miss reapplication even while outdoors or snorkeling.

Context-Aware Notifications

Notifies users exactly when reapplication is needed, reducing overuse while maintaining effective protection for both skin health and environmental impact.

Algorithm

The core algorithm models cumulative UV exposure over time and compares it against the remaining effective protection provided by sunscreen. Reapplication is triggered once a predefined exposure threshold is reached.

1. Sunscreen Degradation Model

The remaining sunscreen on the skin decreases exponentially over time due to sweat, water exposure, and natural degradation.

X(t) = [X0 + X(nT)] · exp[-λ(t − nT)]
X(t) represents the remaining sunscreen effectiveness at time t.
X0 represents the dose of sunscreen put on skin. Recommended dose is 2mg, but normally people put 0.5 - 1.5mg, so we take the average at 1mg.
The last part of the calculation takes the level of activity. There are 3 levels:
  • For high activity level, we take 0.5 value for calculation
  • For medium, we take 2
  • For low, we take 8

2. Effective SPF Calculation

SPF(xt) = 1 + 2(xt) + 2·6(xt)2
This formula estimates the effective SPF remaining on the skin. It adjusts the labeled SPF value based on the remaining sunscreen thickness, acknowledging that reduced application lowers actual UV protection.

This formula varies based on the spf level
  • SPF8: 1 + 0.32(xt) + 2.06(xt)2
  • SPF15: 1 + 2(xt) + 2.06(xt)2
  • SPF25: 1 + 1.43(xt) + 4.73(xt)2
  • SPF30: 1 + 3.74(xt) + 5.38(xt)2
  • SPF40: 1 + 5.51(xt) + 7(xt)2
  • SPF50: 1 + 7.3(xt) + 8.6(xt)2

3. UV Exposure Rate

E(t) = 0.9 × UVI

UV Index (UVI) is converted into an estimated UV exposure rate per hour. The constant 0.9 approximates the standard erythemal weighting used in dermatological UV exposure estimation.

4. Cumulative UV Exposure (SED)

SED = ∫₀ᵗ E(t) / SPF(x) dt

This integral calculates cumulative Standard Erythemal Dose (SED), which represents total UV radiation absorbed by the skin over time after sunscreen protection is applied.
We use 4 hour time frame (t = 4) as a default value for this calculation.

Architecture

The system is composed of an iOS app and an Apple Watch companion app. The iPhone aggregates environmental data and performs calculations, while the Apple Watch supplies motion data and delivers real-time alerts.

The reSPF system is designed as a paired iOS + Apple Watch architecture, where computation, data aggregation, and decision-making are centralized on the iPhone, while the Apple Watch functions as a real-time sensor and notification surface.

The iOS app acts as the core processing unit. It gathers location data via Core Location, retrieves real-time UV index from WeatherKit, and combines this information with user-specific parameters such as selected sunscreen SPF and skin type. Based on this aggregated context, the iOS app continuously evaluates cumulative UV exposure using the reSPF algorithm.

The Apple Watch serves two primary roles. First, it provides motion and activity signals via CoreMotion and SensorKit, allowing the system to infer activity intensity that affects sunscreen degradation. Second, it functions as a low-friction notification endpoint, delivering timely reapplication alerts even when the user is actively outdoors or snorkeling.

Communication between iOS and watchOS is handled through WatchConnectivity (WCSession), ensuring that activity data, timer updates, and notification states remain synchronized across devices. This separation of responsibilities allows the system to remain power-efficient while maintaining high contextual accuracy.

Tech Stack
  • SwiftUI: Used to build a declarative, state-driven user interface across iOS and watchOS. SwiftUI enables real-time UI updates in response to timer changes, sensor updates, and notification states.
  • Weather Kit: Provides authoritative, location-based environmental data including UV Index, weather conditions, and forecasts. This data directly influences the UV exposure rate used in the reapplication calculation.
  • Core Location: Supplies precise geographic positioning required for retrieving accurate, localized UV and weather data. Location updates ensure environmental context remains relevant as users move.
  • WatchConnectivity (WCSession): Enables bidirectional communication between the iPhone and Apple Watch. Used to transmit activity data from watchOS to iOS and to sync recalculated timers and alerts back to the watch.
  • UserNotifications: Manages local notifications for sunscreen reapplication reminders. Notifications are scheduled dynamically based on algorithm outputs rather than fixed intervals.
  • CoreMotion: Collects motion and activity signals such as walking, movement intensity, and stillness. These signals are used to estimate sunscreen wear off rates under different activity conditions.
  • ActivityKit: Supports activity state awareness and integration with system level activity contexts, improving responsiveness when the user is actively moving or engaged outdoors.
  • VisionKit: Used for on-device text recognition to extract SPF values and sunscreen information from product images. This reduces manual input and improves data accuracy.
  • SensorKit: Provides access to advanced sensor data (when permitted), enabling more granular modeling of environmental exposure and user activity patterns, particularly when paired with Apple Watch.
Team
team
  • Jeremy (most front): Project Manager, Researcher, iOS Developer
  • Igor (most left): Lead Developer
  • Annisa (beside Igor): UI/UX Designer
  • Stephan (in front of Annisa): iOS Developer
  • Ravshan (most right): UI/UX Designer
  • Kenzhie (most back): Researcher, iOS Developer
My Contributions

Development

I implemented cross-device state synchronization and real-time user feedback mechanisms to ensure accurate and timely sunscreen reapplication reminders. Using WatchConnectivity, I synchronized timer states, SPF data, and activity status between the iPhone and Apple Watch, keeping all business logic centralized on iOS while the watch functioned as a lightweight display and alert surface.
In parallel, I designed and implemented the UserNotifications flow to schedule reapplication alerts dynamically. Notifications are recalculated and updated based on real-time conditions such as UV exposure and user activity, rather than relying on fixed time intervals.
I also contributed to exploring CoreMotion for detecting water-related activity and submerged conditions. Since water exposure significantly reduces sunscreen effectiveness, this work helped validate how motion signals could be incorporated into the reapplication logic to adjust timer behavior accordingly.

Algorithm Validation & Logic Review

Although the core formulas were primarily developed by my teammates, I actively contributed by reviewing and validating the calculations, checking logical consistency, assumptions, and edge cases. I helped translate theoretical models into implementation-ready logic suitable for real-world usage.

Collaboration, Version Control & Code Quality

I was involved in setting up and maintaining the Git workflow, resolving merge conflicts, and reviewing teammates' code to improve clarity and maintainability. I also participated in refactoring efforts to keep the codebase organized and aligned with best practices.

Ideation & Design Feedback

Beyond development, I took part in early brainstorming and ideation sessions, contributing technical perspectives to feature feasibility. I also provided feedback on UI and interaction design to ensure smooth integration with system logic and platform constraints.