Better Sleep is a SwiftUI breathing timer for iPhone. A session cycles through inhale, hold, and exhale stages, plays distinct transition cues, and can keep the user's choice of white, pink, brown, green, blue, violet, or gray noise playing while the app is in the background. Continuous noise can also be turned off while keeping the breathing cues. The default session length is five minutes.
- Open
BetterSleep.xcodeprojin Xcode. - Select the
BetterSleepscheme and an iPhone simulator or device. - Build and run.
The project targets iOS 17 and has no third-party dependencies. Background audio support is declared in BetterSleep/Info.plist.
BetterSleep/
├── BetterSleep.xcodeproj/ # Xcode project and build settings
├── BetterSleep/
│ ├── App/ # Application entry point
│ ├── DesignSystem/ # Shared colors, styles, and backgrounds
│ ├── Features/
│ │ └── Breathing/
│ │ ├── Models/ # Session configuration and stage types
│ │ ├── Services/ # Audio engine, noise, and cue generation
│ │ ├── State/ # Timer and session orchestration
│ │ └── Views/ # Setup, active, and completion screens
│ ├── Assets.xcassets/ # App icon and asset catalog
│ └── Info.plist # App metadata and background audio mode
└── README.md
The BetterSleep source folder is synchronized with the Xcode target, so Swift files added anywhere inside it are included automatically. Keep documentation, scripts, and other non-app files outside that folder unless they should be bundled into the application target.
- Change default inhale, hold, exhale, or total duration values in
BreathingModels.swift. - Change timer behavior and stage transitions in
BreathingSession.swift. - Change noise generation or cue sounds in
BreathingAudioService.swift. - Change shared colors and button styling in
SleepTheme.swift. - Change individual screens in the corresponding file under
Features/Breathing/Views.
DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer \
xcodebuild \
-project BetterSleep.xcodeproj \
-scheme BetterSleep \
-sdk iphonesimulator \
-configuration Debug \
-derivedDataPath /tmp/BetterSleepDerivedData \
CODE_SIGNING_ALLOWED=NO \
build