Skip to content

Instantly share code, notes, and snippets.

@mitnick78
Created February 26, 2022 22:38
Show Gist options
  • Save mitnick78/05a460882116fc0f5937abad17f1a6de to your computer and use it in GitHub Desktop.
Save mitnick78/05a460882116fc0f5937abad17f1a6de to your computer and use it in GitHub Desktop.
//
// FirebaseManager.swift
// logbookLanguage
//
// Created by Christophe on 25/02/2022.
//
import Foundation
import Firebase
class FirebaseManager {
static let shared = FirebaseManager()
var auth: Auth
var cloudFirestore: Firestore
init() {
FirebaseApp.configure()
auth = Auth.auth()
cloudFirestore = Firestore.firestore()
}
func getId() -> String? {
return auth.currentUser?.uid
}
var learnsRef: CollectionReference {
return cloudFirestore.collection(LEARNS)
}
func getLearnByUser() -> Query {
return learnsRef.whereField("user_id", isEqualTo: getId())
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment