Ch.8.22 Saving Images to Firebase Storage w/a Cloud Firestore Reference

Опубликовано: 10 Октябрь 2024
на канале: Prof. John Gallaugher
3,584
58

We'll add an essential full-stack skill in this Swift/iOS tutorial as we learn to not only save an image to Google Firebase Storage, but also how to save a reference to a Cloud Firestore Database so our app will be able to later access and display this image. We'll cover the structure of Firebase Storage file paths, we'll create a structure to keep track of Firebase Storage images using Cloud Firestore. We'll show basic code to save to Firebase Storage, as well as how to extend it to also save a database reference to the saved file. As always, expect much enthusiasm in this tutorial video. Part of Prof. Gallaugher's Zero-to-Full-Stack University Course. For more info, see https://gallaugher.com/swift
---
Small update that doesn't impact the code: The video showed an error line reporting the ref as metaData. It should report any erroneous ref as storageRef, as shown below:
print("😡 ERROR: upload for ref \(storageRef) failed. \(error.localizedDescription)")
It won't impact the execution of your code, but if you ever reuse this code & run into an error, you'll likely want the storageRef to show instead of metaData.