Saving Image to Firebase Storage and getting Image Url

PHOTO EMBED

Sat Jan 08 2022 09:45:11 GMT+0000 (Coordinated Universal Time)

Saved by @hasnat #ios #swift #image

func getImageUrl(){
    print("get Image Url")
    guard let imageData = postPictureImageView.image?.jpegData(compressionQuality: 0.5) else { return }
    let timeStamp = Int(Date().timeIntervalSince1970)
    let storageRef = Storage.storage().reference().child("Posted Images/\(timeStamp).jpg")
    storageRef.putData(imageData, metadata: nil) { (metadata, error) in
        if error != nil {
            print("error")
        } else {
            storageRef.downloadURL { (url, error) in
                if let url =  url?.absoluteString {
                    Url = String(url)
                    }
                }
            }
        }
    }
}
content_copyCOPY