This is a SwiftUI application for iOS that uses the GitHub API to fetch and display user and repository information.
The application is built using Swift and the SwiftUI framework. It demonstrates how to authenticate with the GitHub API, fetch user data, and display it in a clean, user-friendly interface.
Login screen | Login flow 1 | Login flow 2 | Login flow 3 | Private repo | Public repo | Account info | Follow and followers |
---|---|---|---|---|---|---|---|
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
- SwiftUI: The entire user interface is built using Apple's modern, declarative UI framework.
- SwiftData: For persisting data locally, providing a seamless and powerful way to manage the app's data.
- MVVM (Model-View-ViewModel): The app follows the MVVM architectural pattern to ensure a clean separation of concerns and a scalable codebase.
- GitHub API Integration: The app uses the GitHub REST API to fetch public and private repositories, user information, followers, and following lists.
- Authentication: The app will implement a secure authentication method to allow users to log in with their GitHub account.
- SwiftUI Views: The UI is built entirely with SwiftUI, showcasing how to create declarative and responsive user interfaces.
- macOS with Xcode installed.
- A GitHub account.
- Clone the repository (if you haven't already):
git clone <repository-url>
- Open the project in Xcode:
Navigate to the project directory and open the
GithubProfiler.xcodeproj
file.cd path/to/GithubProfiler open GithubProfiler.xcodeproj
- Configure API Keys: You will need to add your GitHub API keys to the project. Create a new Swift file named
APIKeys.swift
in theGithubProfiler
directory and add the following code:import Foundation struct APIKeys { static let clientID = "YOUR_CLIENT_ID" static let clientSecret = "YOUR_CLIENT_SECRET" }
- Select a simulator or device: In Xcode, choose an iOS simulator (e.g., iPhone 15 Pro) or connect a physical iOS device.
- Run the application:
Click the "Play" button (or press
Cmd+R
) in Xcode to build and run the application on the selected simulator or device.
The API layer is responsible for all communication with the GitHub API. It is built using a combination of URLSession
and Combine
to handle asynchronous network requests.
- APIManager.swift: This class will be the central point of contact for all API requests. It will handle authentication, request creation, and response parsing.
- Models: The project will include a
Models
directory containing Swift structs that map to the JSON responses from the GitHub API. These models will be used to decode the API responses into a type-safe format.
The user interface is built using SwiftUI. The following views will be implemented:
- LoginView.swift: This view will provide a simple interface for users to log in with their GitHub account.
- ProfileView.swift: This view will display the user's profile information, including their avatar, username, and bio.
- RepositoryListView.swift: This view will display a list of the user's public and private repositories.
- FollowersView.swift: This view will display a list of the user's followers.
- FollowingView.swift: This view will display a list of the users that the current user is following.
The project includes unit tests (GithubProfilerTests/GithubProfilerTests.swift
) and UI tests (GithubProfilerUITests/GithubProfilerUITests.swift
).
To run tests:
- Open the project in Xcode.
- Go to Product > Test (or press
Cmd+U
).
This README provides a comprehensive overview of the project. As the project evolves, this document will be updated to reflect the latest changes.