Training

SwiftUI developed iOS app.

In my work on Training, I focused on building a comprehensive fitness app using SwiftUI, SwiftData, and HealthKit to manage workout plans, track user progress, and seamlessly integrate with iOS’s health ecosystem.

Technologies and Key Features Explored:

SwiftUI: I utilised SwiftUI to create an intuitive user interface, leveraging its modern declarative syntax for real-time previews, dynamic content, and responsive layouts.

SwiftData & Persistence: Designed the app’s architecture using SwiftData to handle persistence for workout plans, completed workouts, and associated statistics. I explored complex predicate filtering, and efficient data storage solutions using custom struct data types for recurring workouts.

HealthKit Integration: Deep integration with HealthKit allows users to log, track, and analyse their workouts by pulling in activity metrics such as heart rate, distance, and calories burned. This includes fetching workout statistics and supporting multi-activity tracking through HealthKit data.

Predicate Queries: Implemented complex SwiftData predicate queries for filtering workouts based on date, recurrence patterns, and goals. This included performance optimisations by transitioning from DateComponents to Date for faster querying.

User Goal Management: Built a system for users to create, update, and track fitness goals, using HKQuantityTypeIdentifiers for specific metrics such as speed, distance, and energy expenditure. The goals system supports various comparison operators (e.g., >=, <=), making goal tracking flexible and user-specific.

Reoccurring Workouts: Developed a robust system for creating and managing recurring workouts without duplicating data unnecessarily, implementing a custom WeekDay enum for flexible schedule handling.

Error Handling & Logging: Created a custom LogManager and ErrorManager to capture and export app errors and system events, providing users with insights and assisting in debugging.

App Storage & Localisation: Used @AppStorage to persist user preferences, and ensured the app dynamically adapts to locale changes, especially for recurring workout schedules.

Through this project, I’ve honed my skills in state management, SwiftData persistence strategies, and integrating with native iOS frameworks like HealthKit. The result is a robust, flexible application that caters to diverse fitness tracking needs.