And what is the procedure to upload the pic directly on Firebase and after retrieve it?
Gennaro Caccavale

I never tried Firebase, but with a simple google search I found out this Gist ,SO answer and Firebase documentation on Upload Files on IOS.

Since we already have image data from AVCapturePhotoOutput , we can simply upload the data to Firebase.

Code from Documentation below

// Data in memory
let data = Data()

// Create a reference to the file you want to upload
let riversRef = storageRef.child("images/rivers.jpg")

// Upload the file to the path "images/rivers.jpg"
let uploadTask = riversRef.putData(data, metadata: nil) { (metadata, error) in
guard let metadata = metadata else {
// Uh-oh, an error occurred!
// Metadata contains file metadata such as size, content-type, and download URL.
let downloadURL = metadata.downloadURL

Hope this would help you