This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func downloadImage(from storageImagePath: String) { | |
| // 1. Get a filePath to save the image at | |
| let paths = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true) | |
| let documentsDirectory = paths[0] | |
| let filePath = "file:\(documentsDirectory)/myimage.jpg" | |
| // 2. Get the url of that file path | |
| guard let fileURL = URL(string: filePath) else { return } | |
| // 3. Start download of image and write it to the file url | |
| storageDownloadTask = storageRef.child(storageImagePath).write(toFile: fileURL, completion: { (url, error) in |
OlderNewer