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) } } } } } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter