Hi! My name is Alex, and this is a personal project to improve my skills as an iOS developer.
Many of us spend long hours in front of screens. DailyGYM aims to simplify fitness by eliminating the guesswork and making it easy to stay active, whether you're at home, at work, or on the go.
DailyGYM is a fitness app designed for iOS to help users maintain an active lifestyle conveniently from their devices. Whether you're a beginner or a seasoned fitness enthusiast, DailyGYM provides tailored daily exercise routines to fit your skill level and personal goals.
-
Daily Routines: Automatically generated daily exercise routines based on your skills and preferences.
-
Customization: Ability to create and customize personal workout routines from a wide variety of exercises.
-
User-Friendly Interface: Intuitive and easy-to-use design for a seamless fitness experience.
-
Motivation: Track your progress and stay motivated with built-in features.
MVVM is an architecture that clearly separates presentation logic (View) from business logic (ViewModel) and data (Model).
-
Model: Defines the "Exercise" struct representing an exercise with the name, type muscle, the intensity lvl, video, It implements Identifiable to uniquely identify each exercise in a list, and so on.
-
ViewModel: Acts as an intermediary between the View (UI) and the Model (data and business logic) and manages the state of the View. @Published is a Property Wrapper SwiftUI and Combine framework. It is used in ViewModels to automatically notify the View when a property changes. This enables reactive UI updates based on data changes.
-
View: The view primarily focuses on rendering the user interface and responding to user interactions. In ContentView, it binds to view models to display profile information, daily routines, and exercise lists. It also manages navigation to different views and displays history in a modal sheet based on user actions.
DailyGYM utilizes JSON for data persistence, allowing efficient storage and retrieval of exercise routines. Here's how it works:
- Encoding and Storage: Exercise routines are encoded into JSON format using JSONEncoder and stored in the local file system of the application.
- Data Retrieval: Upon application launch, DailyGYM checks for previously saved data. If data is found, it is loaded and used; otherwise, it initializes with an empty array.
This approach ensures users can maintain and customize their exercise routines, even when offline.
All data we use for the app is obtained from an API. DailyGYM connects to an external API to fetch tailored daily exercises and user profiles. We use URLSession in Swift to make HTTP GET requests to the API, which returns data in JSON format. The received data is decoded using JSONDecoder and used to update the local data models in our application.
The API accepts query parameters that allow filtering by a list of specific muscles, name, equipment, and more. However, for simplicity and to keep the app intuitive, DailyGYM primarily uses the muscle type query parameter.
I hope you find it interesting!
To install DailyGYM, simply clone the repository and run it on your iOS device using Xcode.
Launch the App: Open DailyGYM on your iOS device.
Explore and Customize: Browse through daily routines or create your own by selecting exercises that suit your needs.
Stay Active: Follow your chosen routine daily to maintain a healthy lifestyle.
Your feedback is valuable! If you have any suggestions, issues, or feature requests, please submit an issue or contact us through alexmaxu12@gmail.com.