SwiftUI + Firebase template

Overview

SwiftUI + Firebase template project

This is a template project with SwiftUI and Firebase. You can create an iOS with SwiftUI and Firebase right away without spending time on backend development! 🚀

Integrated Firebase services are following

  • Firestore Database
  • Firebase App Check
  • Authentication
  • Functions
  • Analytics

Features

This app has the following design.

.
├── Animations                      # Lotties JSON files
├── Localization                    # Localization files (`*.strings`)
├── Utils                           # Utility functions 
├── Services                        # Service classes (business domain)
├── Repositories                    # Repository classes (data layer)
├── Views                           # View classes (view layer)
├── Extensions                      # Swift extension files
├── GoogleService-Info.plist        # Firebase config file (git ignored)
└── README.md
  • This project sets up necessary service classes in ContentView.swift through environmentObject. View files that need to access services simply declare @EnvironmentObject, like @EnvironmentObject var postService: SamplePostService.
  • Views/Styles.swift has a convenient view modifier called .style(_). You can style Text like Text("Hello world!").style(.header).
  • This project employs Lottie for rendering animations. Please refer Views/Common/LottieView.swift.
  • This project has integrated Firebase Authentication by default. You don't have to force users to explicitly sign up for using your app.
  • This project has integrated Firebase Firestore. The UI of this project reflects the CRUD in real time. It is recommended to update the Firestore rules (see a following sample).
  • This project has integrated Firebase Analytics. Please refer Utils/AnalyticsUtil.swift. If you call AnalyticsUtil.logEvent(.something), this event will be recorded in Firebase Analytics.

Here is a sample of Firestore rule managed on Firebase Console. In this sample, posts has a user directory where only the owner can access. On the other hand, the second something is accessible for every logged-in users (anonymous login is fine).

rules_version = '2';
service cloud.firestore {
  match /databases/{database}/documents {
    match /posts/{userId}/{document=**} {
      allow read, update, delete: if request.auth != null && request.auth.uid == userId;
      allow create: if request.auth != null;
    }
    match /something/{document=**} {
      allow read: if request.auth != null;
    }
  }
}

How to use

Just fork the repository on GitHub and go to "Create a new repository" page. You will find swiftui-firebase-template in the Repository template section! 😄

Then you have to set up a Firebase project.

  1. Clone your new repository to your local machine
  2. Create a new Firebase project (Please enable Firebase Auth anonymous login and Firestore)
  3. Add GoogleService-Info.plist in the new repository
  4. Start adding your own implementation

If you see build errors, you may need to remove and re-add Swift Package dependencies.

img

If you want to add some logic around database (Firestore), please refer to this documentation

License

MIT

You might also like...
Shopify app template powered by DSKit
Shopify app template powered by DSKit

This project is powered by DSKit a Design System Kit for iOS 13+, an iOS SDK written in Swift with a collection of reusable components, guided by clear standards, that can be assembled to build any number of applications.

Instagram clone with firebase and swift
Instagram clone with firebase and swift

Instagram clone with firebase and swift

 iOS Open-Source Telematics App with Firebase© integration
iOS Open-Source Telematics App with Firebase© integration

Open-source telematics app for iOS. The application is suitable for UBI (Usage-based insurance), shared mobility, transportation, safe driving, tracking, family trackers, drive-coach, and other driving mobile applications

A grocery list app for families written in Swift using Firebase Realtime Database

FamiList | Grocery list app in Swift FamiList is a grocery list app for families written in Swift using Firebase Realtime Database. You can add differ

The ToDoList application using FireBase allows you to register users
The ToDoList application using FireBase allows you to register users

ToDoFirebase Приложение ToDoList с использовавнием FireBase позволяет зарегистри

A detailed clone of the Instagram app built with Firebase
A detailed clone of the Instagram app built with Firebase

[This repository is no longer being maintained] InstagramClone A detailed clone

Learning App with Firebase Auth
Learning App with Firebase Auth

Learning App Displays how to make a learning app with Swift, iOS's programming l

Firebase Quickstart Samples for iOS

Firebase Quickstarts for iOS A collection of quickstart samples demonstrating the Firebase APIs on iOS. Each sample contains targets for both Objectiv

Warning pushNotification - Using push notification with Firebase Cloud Messaging

재난문자 푸시 알림 구현 1) 구현 기능 2) 기본 개념 (1) Remote Notification 불시에 발생한 업데이트 불특정 시간 예측 불

Owner
Shu
Full Stack Engineer. iOS / React Native / React / Node.js / Ruby / Ethereum / EOS / Firebase Tab > Space; Vim > Emacs
Shu
Firebase Analytics Firebase Notification Alamofire KingFisher Ombdb API

MovieOmdbApp Firebase Analytics Firebase Notification Alamofire KingFisher Ombdb

Kaya 0 Dec 20, 2021
An iOS template project using SwiftUI, Combine and MVVM-C software architecture

SwiftUI-MVVM-C A template project that uses SwiftUI for UI, Combine for event handling, MVVM-C for software architecture. I have done some small proje

Huy Nguyen 107 Jan 2, 2023
Simple Todo Application using SwiftUI / Firebase / Redux.

Simple Todo Application using SwiftUI/Firebase/Redux/Combine. Light _ _ _ _ Dark _ _ _ Feature Use SwiftUI fully. Use Firebase. Authentication Cloud F

Suguru Kishimoto 337 Dec 25, 2022
Completed Project for Authentication in SwiftUI using Firebase Auth SDK & Sign in with Apple

Completed Project for Authentication in SwiftUI using Firebase Auth SDK & Sign in with Apple Follow the tutorial at alfianlosari.com Features Uses Fir

Alfian Losari 43 Dec 22, 2022
SwiftUI, Firebase, Kingfisher, googleapis

SwiftUI-KokaiByWGO Xcode Version 12.0 SwiftUI, Firebase, Kingfisher, googleapis Learn Thai with pictures and sounds Note : This version have no CMS so

Waleerat S. 0 Oct 6, 2021
Social Media platform build with swiftUI and Firebase with google and apple account integration for Signing In Users

Social Media platform build with swiftUI and Firebase with google and apple account integration for Signing In Users . Providing Users availability to upload posts and images add caption allowing other users to comment , with Find section to explore new people , new stories , User Profile section to allow the user to take control of his account .

Devang Papinwar 2 Jul 11, 2022
The app demonstrates how to use Firebase in a SwiftUI iOS app

Firebase SwiftUIDemo app This app demonstrates how to use Firebase in a SwiftUI iOS app. Firebase Setup Go to firebase.com Click new project. Copy app

Andrew Gholson 0 Nov 28, 2021
A SwiftUI component which handles logging in with Apple to Firebase

Login with Apple Firebase SwiftUI I made this SwiftUI component to handle logging in with Apple to Firebase. Demo Gif Usage in SwiftUI struct ContentV

Joe Hinkle 153 Dec 23, 2022
Aplikasi iOS Simulasi CRUD Stok Barang dengan SwiftUI, Firebase CLI & Firestore

iStockery Aplikasi iStockery adalah aplikasi stok inventory berbasis iOS yang dibuat menggunakan Firebase (Firestore) secara Local dengan fitur CRUD d

DK 7 Aug 1, 2022