Welcome to Threads SwiftUI β an intuitive and feature-rich application built for iOS 17, designed to provide a seamless platform for users to share thoughts, engage in meaningful conversations, and comment on trending topics across the globe. ππ¬
This app is powered by SwiftUI, Apple's declarative framework for building modern user interfaces, and follows Clean Code principles to ensure scalability, maintainability, and high performance. Whether youβre looking to stay updated with the latest trends, share your opinion, or interact with other users, Threads SwiftUI is crafted to provide a smooth and enjoyable experience. β¨π±
I would like to express my sincere gratitude to the AppStuff YouTube channel for providing such valuable resources. I used one of the channelβs videos as a key learning tool and starting point for developing my Threads app in SwiftUI. The tutorial was incredibly helpful in understanding UI development, and it gave me a solid foundation to build upon. Since then, Iβve made significant modifications to the app with my own architecture approach and added new features. Your content has been a huge inspiration and has played a key role in my progress. Thanks again for all the help!
This app, includes images and resources designed by Freepik. We would like to acknowledge and thank Freepik for their incredible design assets. The images used in the app are provided with attribution, as required by Freepik's licensing terms. For more information on Freepik's resources, please visit www.freepik.com.
Slides are built using the template from Previewed. I extend my gratitude to them for their remarkable work and contribution.
Threads SwiftUI is a dynamic iOS application developed with SwiftUI and powered by Firebase to provide users with a seamless platform to share their thoughts, connect with others, and explore new ideas. Built for iOS 17, this app allows users to create, comment, like, and share Threadsβshort posts or thoughts on various topics. π
The app utilizes Firebase Authentication to manage user accounts and Firestore (Firebase's NoSQL database) to store user data, threads, and interactions in real-time. This ensures a highly responsive and secure experience for users, allowing them to engage with others and track their activity effortlessly.
Users can explore new people, follow them, and get notified when their content receives likes, comments, or shares. Notifications are delivered in real-time, alerting users when someone interacts with their threads or follows them, creating an engaging social environment.
In addition, users have the ability to personalize their profile, adding a personal touch to their account and showcasing their unique identity.
-
User Authentication: Users can securely sign up and log in using Firebase Authentication π
-
Create and Share Threads: Users can post their thoughts, ideas, and creative content as Threads. These threads can be about any topic, and users can freely express their opinions or share updates. ππ‘
-
Engage with Content: Other users can like, comment, share, and repost threads to foster conversation and engagement. π£β€οΈ
-
Follow Users: Explore and follow other users to stay updated with their content and thoughts. π²π₯
-
Real-Time Notifications: The app delivers real-time notifications to alert users when someone likes their thread, comments, or follows them. Users can keep track of all interactions in their notification center. ππ¬
-
Profile Customization: Users can personalize their profiles by adding images, bio information, and other customizable details to showcase their individuality. ππ€
-
Explore New People: Users can discover other users, follow them, and expand their social network within the app. ππ€
-
Built with Firebase: The app uses Firestore for storing user data, threads, likes, comments, and other interactions in real-time, making it a fast and responsive experience. β‘π₯
-
Clean Architecture: The app follows Clean Code principles and uses SwiftUI for creating modern, maintainable, and scalable user interfaces. π οΈπ
Threads SwiftUI follows a modern MVVM (Model-View-ViewModel) pattern combined with Clean Architecture principles to provide a scalable, maintainable, and testable application structure. This approach ensures separation of concerns, clear data flow, and easy extensibility as the project grows.
- Model: Represents the core data structures of the application (e.g.,
Notification
,User
). - View: The SwiftUI views that display the UI components, like
NotificationCell
,ActivityView
, andProfileView
. - ViewModel: Contains the logic for transforming the raw data into something that the View can display. The ViewModel communicates with use cases and interacts with use cases to fetch data.
Clean Architecture divides the application into independent layers:
-
Use Case Layer: Contains the application-specific business logic, including the actions users can perform, such as creating a thread, fetching notifications, etc. Each use case is represented by a class that handles a specific feature (e.g.,
CreateThreadUseCase
,FetchNotificationsUseCase
). -
Repository Layer: Abstracts the data-fetching logic, providing a unified API for interacting with different data sources. It retrieves and manipulates data through various repositories (e.g.,
NotificationsRepository
,UserRepository
). This layer interacts with external services like Firebase and abstracts Firebase interactions behind a clean interface. -
DataSource Layer: Deals directly with the external data sources (e.g., Firebase, network APIs) and returns the raw data to be passed to the repository layer. This layer abstracts the direct communication with Firebase, ensuring that the repository only interacts with the data layer and does not need to know about its implementation details.
SwiftUI is used for building declarative user interfaces, offering a reactive, dynamic, and flexible UI that updates as the data changes. The Combine framework is used for reactive programming, allowing us to bind data to views, enabling real-time updates to the user interface. This combination of SwiftUI and Combine ensures the app reacts to changes in data seamlessly, particularly for features like notifications, likes, and user actions.
The application utilizes an IoC (Inversion of Control) container with a Factory design pattern to manage dependency injection. This allows for better separation of concerns and ensures that the dependencies (such as repositories, use cases, etc.) are injected into the classes that require them. It simplifies unit testing and enhances modularity by making the app more flexible and extensible.
To ensure the app remains testable and maintainable, Firebase interactions (e.g., authentication and Firestore) are abstracted through repository and data source layers. Instead of directly using Firebase SDKs throughout the app, all Firebase-related calls are routed through specific data sources like UserDataSource
and NotificationsDataSource
. This abstraction allows easy switching or mocking of Firebase for testing and future scalability.
Threads SwiftUI utilizes various modern technologies and libraries to provide a rich, interactive, and high-performance user experience. Below is a list of key technologies and frameworks used in the app:
- Firestore: A real-time NoSQL database that stores all user data, threads, notifications, likes, and comments. Firestore allows for real-time data synchronization across devices, enabling seamless user interactions.
- Firebase Authentication: Handles secure user sign-in and registration with multiple authentication providers (e.g., email/password, Google, Apple). Firebase Authentication ensures user data is protected and supports scalable authentication methods.
- SwiftUI: Used for building the entire UI of the app. Its declarative syntax and native integration with iOS allow for easy development and maintenance of UI components.
- Combine: The reactive framework that integrates with SwiftUI to manage state changes. Combine enables binding data to views and handling asynchronous events, like network calls and real-time updates.
- IoC Container: The app leverages an IoC container to manage dependencies and handle the injection of services like repositories, use cases, and data sources, making the architecture more modular and testable.
- Factory Pattern: The Factory pattern is used in combination with the IoC container to create instances of required objects and services, providing better separation of concerns and flexibility.
-
Kingfisher: A powerful image downloading and caching library for Swift. Kingfisher is used for handling profile images and other images in the app, ensuring they are efficiently cached and loaded asynchronously.
-
SwipeActions: A native SwiftUI feature that enables swipe actions on rows, allowing users to delete or perform actions like marking notifications as read. The swipe actions are enhanced to provide a clean and intuitive UX.
- UIKit: While SwiftUI is the primary UI framework, UIKit is also used for certain UI elements (e.g., custom image views, gesture recognizers) where SwiftUI lacks support.
Here are some screenshots from our app to give you a glimpse of its design and functionality.
Contributions are welcome! If you'd like to contribute to ThreadsSwiftUI, please fork the repository and create a pull request with your changes.
ThreadsSwiftUI is inspired by the functionality and design of Threads from Meta.
We express our deep appreciation to Freepik for generously providing the resources used in this project.
I would like to express my sincere gratitude to the AppStuff YouTube channel for providing such valuable resources. I used one of the channelβs videos as a key learning tool and starting point for developing my Threads app in SwiftUI. The tutorial was incredibly helpful in understanding UI development, and it gave me a solid foundation to build upon. Since then, Iβve made significant modifications to the app with my own architecture approach and added new features. Your content has been a huge inspiration and has played a key role in my progress. Thanks again for all the help!
Template mockup from https://previewed.app/template/AFC0B4CB
This project is licensed under the MIT License, an open-source software license that allows developers to freely use, copy, modify, and distribute the software. π οΈ This includes use in both personal and commercial projects, with the only requirement being that the original copyright notice is retained. π
Please note the following limitations:
- The software is provided "as is", without any warranties, express or implied. π«π‘οΈ
- If you distribute the software, whether in original or modified form, you must include the original copyright notice and license. π
- The license allows for commercial use, but you cannot claim ownership over the software itself. π·οΈ
The goal of this license is to maximize freedom for developers while maintaining recognition for the original creators.
MIT License
Copyright (c) 2024 Dream software - Sergio SΓ‘nchez
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.