LCFile
public class LCFile : LCObject
LeanCloud File Type
-
Declaration
Swift
public final override class func objectClassName() -> String
-
The file URL.
Declaration
Swift
@objc public dynamic var url: LCString?
-
The file key.
It’s the resource key of third-party file hosting provider. It may be nil for some providers.
Declaration
Swift
@objc public dynamic var key: LCString?
-
The file name.
Declaration
Swift
@objc public dynamic var name: LCString?
-
The file meta data.
Declaration
Swift
@objc public dynamic var metaData: LCDictionary?
-
The file hosting provider.
Declaration
Swift
@objc public dynamic var provider: LCString?
-
The file bucket.
Declaration
Swift
@objc public dynamic var bucket: LCString?
-
The MIME type of file.
For uploading, you can use this property to explictly set MIME type of file content.
It’s an alias of property ‘mime_type’.
Declaration
Swift
public var mimeType: LCString? { get set }
-
File Payload.
See moreDeclaration
Swift
public enum Payload
-
Create a file using default application.
Declaration
Swift
public required init()
-
Create a file using a application.
Declaration
Swift
public required init(application: LCApplication)
Parameters
application
The application which this file belong to.
-
Create a file with a URL.
Declaration
Swift
public convenience init( application: LCApplication = .default, url: LCStringConvertible)
Parameters
application
The application which this file belong to. default is default application.
url
The location of a resource on a remote server.
-
Create a file from payload.
Declaration
Swift
public convenience init( application: LCApplication = .default, payload: Payload)
Parameters
application
The application which this file belong to. default is default application.
payload
@see
Payload
.
-
If set it to
true
, then will use “/(LCFile.name)” as URL suffix when creating file from payload. default isfalse
.Declaration
Swift
public var keepFileName: Bool
-
Save Options
See moreDeclaration
Swift
public struct Options : OptionSet
-
Save file synchronously.
Declaration
Swift
public func save(options: LCFile.Options = []) -> LCBooleanResult
Parameters
options
@see
LCFile.Options
, default is none. -
Save file asynchronously.
Declaration
Swift
@discardableResult public func save( options: LCFile.Options = [], progressQueue: DispatchQueue = .main, progress: ((Double) -> Void)? = nil, completionQueue: DispatchQueue = .main, completion: @escaping (LCBooleanResult) -> Void) -> LCRequest
Parameters
options
@see
LCFile.Options
, default is none.progressQueue
The queue where the progress be called. default is main.
progress
The progress of saving.
completionQueue
The queue where the completion be called. default is main.
completion
The callback of result.