Storage
@available(iOS 13, tvOS 13, macOS 10.15, watchOS 7, *)
@objc(FIRStorage)
open class Storage : NSObjectFirebase Storage is a service that supports uploading and downloading binary objects,
such as images, videos, and other files to Google Cloud Storage. Instances of Storage
are not thread-safe, but can be accessed from any thread.
If you call Storage.storage(), the instance will initialize with the default FirebaseApp,
FirebaseApp.app(), and the storage location will come from the provided
GoogleService-Info.plist.
If you provide a custom instance of FirebaseApp,
the storage location will be specified via the FirebaseOptions.storageBucket property.
-
The default
Storageinstance.Declaration
Swift
@objc(storage) open class func storage() -> StorageReturn Value
An instance of
Storage, configured with the defaultFirebaseApp. -
A method used to create
Storageinstances initialized with a custom storage bucket URL.Any
StorageReferencesgenerated from this instance ofStoragewill reference files and directories within the specified bucket.Declaration
Swift
@objc(storageWithURL:) open class func storage(url: String) -> StorageParameters
urlThe
gs://URL to your Firebase Storage bucket.Return Value
A
Storageinstance, configured with the custom storage bucket. -
Creates an instance of
Storage, configured with a customFirebaseApp.StorageReferences generated from a resulting instance will reference files in the Firebase project associated with customFirebaseApp.Declaration
Swift
@objc(storageForApp:) open class func storage(app: FirebaseApp) -> StorageParameters
appThe custom
FirebaseAppused for initialization.Return Value
A
Storageinstance, configured with the customFirebaseApp. -
Creates an instance of
Storage, configured with a customFirebaseAppand a custom storage bucket URL.Declaration
Swift
@objc(storageForApp:URL:) open class func storage(app: FirebaseApp, url: String) -> StorageParameters
appThe custom
FirebaseAppused for initialization.urlThe
gs://url to your Firebase Storage bucket.Return Value
The
Storageinstance, configured with the customFirebaseAppand storage bucket URL. -
The
FirebaseAppassociated with this Storage instance.Declaration
Swift
@objc public let app: FirebaseApp -
The maximum time in seconds to retry an upload if a failure occurs. Defaults to 10 minutes (600 seconds).
Declaration
Swift
@objc public var maxUploadRetryTime: TimeInterval { get set } -
The maximum time in seconds to retry a download if a failure occurs. Defaults to 10 minutes (600 seconds).
Declaration
Swift
@objc public var maxDownloadRetryTime: TimeInterval { get set } -
The maximum time in seconds to retry operations other than upload and download if a failure occurs. Defaults to 2 minutes (120 seconds).
Declaration
Swift
@objc public var maxOperationRetryTime: TimeInterval { get set } -
Specify the maximum upload chunk size. Values less than 256K (262144) will be rounded up to 256K. Values above 256K will be rounded down to the nearest 256K multiple. The default is no maximum.
Declaration
Swift
@objc public var uploadChunkSizeBytes: Int64 -
A
DispatchQueuethat all developer callbacks are fired on. Defaults to the main queue.Declaration
Swift
@objc public var callbackQueue: DispatchQueue -
Creates a
StorageReferenceinitialized at the root Firebase Storage location.Declaration
Swift
@available(iOS 13, tvOS 13, macOS 10.15, watchOS 7, *) @objc open func reference() -> StorageReferenceReturn Value
An instance of
StorageReferencereferencing the root of the storage bucket. -
Creates a StorageReference given a
gs://,http://, orhttps://URL pointing to a Firebase Storage location.For example, you can pass in an
https://download URL retrieved fromStorageReference.downloadURL(completion:)or thegs://URL fromStorageReference.description.Throws
Throws a fatal error ifurlis not associated with theFirebaseAppused to initialize this Storage instance.Declaration
Swift
@available(iOS 13, tvOS 13, macOS 10.15, watchOS 7, *) @objc open func reference(forURL url: String) -> StorageReferenceParameters
urlA gs:// or https:// URL to initialize the reference with.
Return Value
An instance of StorageReference at the given child path.
-
Creates a StorageReference given a
gs://,http://, orhttps://URL pointing to a Firebase Storage location.For example, you can pass in an
https://download URL retrieved fromStorageReference.downloadURL(completion:)or thegs://URL fromStorageReference.description.Throws
Throws an Error ifurlis not associated with theFirebaseAppused to initialize this Storage instance.Declaration
Swift
open func reference(for url: URL) throws -> StorageReferenceParameters
urlA gs:// or https:// URL to initialize the reference with.
Return Value
An instance of StorageReference at the given child path.
-
Creates a
StorageReferenceinitialized at a location specified by thepathparameter.Declaration
Swift
@objc(referenceWithPath:) open func reference(withPath path: String) -> StorageReferenceParameters
pathA relative path from the root of the storage bucket, for instance @“path/to/object”.
Return Value
An instance of
StorageReferencepointing to the given path. -
Configures the Storage SDK to use an emulated backend instead of the default remote backend.
This method should be called before invoking any other methods on a new instance of
Storage.Declaration
Swift
@objc open func useEmulator(withHost host: String, port: Int)Parameters
hostA string specifying the host.
portThe port specified as an
Int.
-
Undocumented
Declaration
Swift
override open func copy() -> Any -
Undocumented
Declaration
Swift
override open func isEqual(_ object: Any?) -> Bool -
Undocumented
Declaration
Swift
override public var hash: Int { get }