Skip to content

SleepFocus/SleepFocus_Frontend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

95 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SleepFocus Frontend

Build Status

SleepFocus Frontend is a SwiftUI iOS application that connects Apple Health sleep data, backend scoring services, and model-powered recommendations into a single user experience.

Overview

The app provides:

  • Sign in with Apple authentication and session management.
  • HealthKit data access and sync for sleep and biometric streams.
  • Home dashboard for sleep quality, focus prediction, and recommendations.
  • Insights views for trend analysis and sleep/focus relationships.
  • In-app chat experience for AI-assisted guidance.
  • Smart alarm support with widget integration.

Core Features

  • Authentication

    • Sign in with Apple flow with profile confirmation for new users.
    • Access and refresh token lifecycle support.
    • Secure sign-out with server-side token revocation.
  • Health Data Pipeline

    • Reads HealthKit samples for heart rate, HRV, respiratory rate, wrist temperature, environmental noise, and sleep stages.
    • Builds adaptive chunked payloads to stay within backend upload size limits.
    • Uses deterministic idempotency keys to prevent duplicate ingestion.
    • Supports automatic and manual sync ranges.
  • Home and Insights

    • Fetches home-summary data from backend APIs.
    • Caches month summaries for faster date navigation.
    • Polls for model-backed scores while processing is in progress.
    • Shows sleep metrics and stage breakdown from local HealthKit data for immediate UI feedback.
  • Smart Alarm

    • Widget extension (WidgetSmartAlarm) for alarm-related surfaces.
    • Shared models between app and widget target.

Tech Stack

  • SwiftUI
  • Swift Concurrency (async/await, actor)
  • HealthKit
  • AuthenticationServices (Sign in with Apple)
  • WidgetKit

Project Structure

SleepFocus_Frontend/
  .github/workflows/build.yml
  SleepFocus/
    Components/
    Extensions/
    Models/
    Screens/
    Services/
    ContentView.swift
    SleepFocusApp.swift
  WidgetSmartAlarm/
  SleepFocus.xcodeproj/

Getting Started

1. Requirements

  • macOS with Xcode installed.
  • iOS Simulator or physical iOS device.
  • Apple Developer capabilities configured for:
    • Sign in with Apple
    • HealthKit
    • Widget extension support

2. Clone

git clone git@github.com:SleepFocus/SleepFocus_Frontend.git
cd SleepFocus_Frontend

3. Open in Xcode

Open SleepFocus.xcodeproj, select the SleepFocus scheme, then build and run.

4. Configure Backend Endpoint (if needed)

APIWrapper defaults to:

https://api.sleepfocusapp.com

For local or staging backends, update the base URL in SleepFocus/Services/API_Wrapper.swift or call updateBaseURL(...) at runtime in your app flow.

CI

GitHub Actions workflow: .github/workflows/build.yml

Current workflow behavior:

  • Runs on pushes to main and on pull requests.
  • Executes an iOS simulator build using xcodebuild and the SleepFocus scheme.

Notes

  • This repository contains only the iOS frontend and widget code.
  • Backend APIs and model services are maintained in separate repositories.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages