Skip to content

Instantly share code, notes, and snippets.

@Francoissss1
Created March 27, 2021 02:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Francoissss1/db970aaec63bc522e4fff6d71220d2d4 to your computer and use it in GitHub Desktop.
Save Francoissss1/db970aaec63bc522e4fff6d71220d2d4 to your computer and use it in GitHub Desktop.
Download images from firebase to ios
override func viewWillAppear(_ animated: Bool) {
magsCollectionRef.getDocuments { (snapshot, error) in
if let err = error {
debugPrint("error fetching documents")
}else{
guard let snap = snapshot else { return }
for document in snap.documents {
let data = document.data()
let title = data["title"] as? String ?? "no title"
let periodicity = data["periodicity"] as? String ?? "no periodicity"
let newMags = Mags(title: title, periodicity: periodicity)
self.mags.append(newMags)
}
self.tableView.reloadData()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment