//Para cargar y descargar archivos, podemos utilizar los siguientes métodos: // Cargar un archivo let data = Data() let fileRef = storageRef.child("files").child("fileName") fileRef.putData(data, metadata: nil) { (metadata, error) in if let error = error { print("Error al cargar archivo: \(error.localizedDescription)") return } print("Archivo cargado con éxito") } // Descargar un archivo let fileRef = storageRef.child("files").child("fileName") fileRef.getData(maxSize: 10 * 1024 * 1024) { (data, error) in if let error = error { print("Error al descargar archivo: \(error.localizedDescription)") return } print("Archivo descargado con éxito") }
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