LCFile

Objective-C

@interface LCFile : NSObject <NSCoding>

Swift

class LCFile : NSObject, NSCoding

Undocumented

  • Create file from NSData.

    Declaration

    Objective-C

    + (nonnull instancetype)fileWithData:(nonnull NSData *)data;

    Swift

    convenience init(data: Data)

    Parameters

    data

    Data

    Return Value

    Instance

  • Create file with a name from NSData.

    Declaration

    Objective-C

    + (nonnull instancetype)fileWithData:(nonnull NSData *)data
                                    name:(NSString *_Nullable)name;

    Swift

    convenience init(data: Data, name: String?)

    Parameters

    data

    Data

    name

    Name

    Return Value

    Instance

  • Create file from Local Path

    Declaration

    Objective-C

    + (instancetype _Nullable)fileWithLocalPath:(nonnull NSString *)localPath
                                          error:
                                              (NSError *_Nullable *_Nullable)error;

    Swift

    convenience init(localPath: String) throws

    Parameters

    localPath

    Path

    Return Value

    Instance

  • Create file from Remote URL

    Declaration

    Objective-C

    + (nonnull instancetype)fileWithRemoteURL:(nonnull NSURL *)remoteURL;

    Swift

    convenience init(remoteURL: URL)

    Parameters

    remoteURL

    URL

    Return Value

    Instance

  • Create file from LCObject

    Declaration

    Objective-C

    + (nonnull instancetype)fileWithObject:(nonnull LCObject *)object;

    Swift

    convenience init(object: LCObject)

    Parameters

    object

    LCObject

    Return Value

    Instance

  • Create file from objectId and url

    Declaration

    Objective-C

    + (nonnull instancetype)fileWithObjectId:(nonnull NSString *)objectId
                                         url:(nonnull NSString *)url;

    Swift

    convenience init(objectId: String, url: String)

    Parameters

    objectId

    The ID of the File.

    url

    The url of the File.

  • The id of the file.

    Declaration

    Objective-C

    @property (nonatomic, readonly, nullable) NSString *objectId;

    Swift

    var objectId: String? { get }
  • url

    The url of the file.

    Declaration

    Objective-C

    @property (nonatomic, readonly, nullable) NSString *url;

    Swift

    var url: String? { get }
  • The name of the file.

    Declaration

    Objective-C

    @property (nonatomic, nullable) NSString *name;

    Swift

    var name: String? { get set }
  • File metadata, caller is able to store additional values here.

    Declaration

    Objective-C

    @property (nonatomic, nullable) NSDictionary *metaData;

    Swift

    var metaData: [AnyHashable : Any]? { get set }
  • MIME Type of file.

    Declaration

    Objective-C

    @property (nonatomic, nullable) NSString *mimeType;

    Swift

    var mimeType: String? { get set }
  • ACL

    The access control list for this file.

    Declaration

    Objective-C

    @property (nonatomic, nullable) LCACL *ACL;

    Swift

    var acl: LCACL? { get set }
  • Created date.

    Declaration

    Objective-C

    @property (nonatomic, readonly, nullable) NSDate *createdAt;

    Swift

    var createdAt: Date? { get }
  • Updated date.

    Declaration

    Objective-C

    @property (nonatomic, readonly, nullable) NSDate *updatedAt;

    Swift

    var updatedAt: Date? { get }
  • Undocumented

    Declaration

    Objective-C

    @property (nonatomic, nullable) NSDictionary<NSString *, NSString *> *uploadingHeaders;

    Swift

    var uploadingHeaders: [String : String]? { get set }
  • Returns the value associated with a given key.

    Declaration

    Objective-C

    - (id _Nullable)objectForKey:(nonnull id)key;

    Swift

    func object(forKey key: Any) -> Any?

    Parameters

    key

    Key.

    Return Value

    Value.

  • Upload Method. Use default option LCFileUploadOptionCachingData.

    Declaration

    Objective-C

    - (void)uploadWithCompletionHandler:
        (nonnull void (^)(BOOL, NSError *_Nullable))completionHandler;

    Swift

    func upload(completionHandler: @escaping (Bool, Error?) -> Void)

    Parameters

    completionHandler

    Completion Handler.

  • Upload Method. Use default option LCFileUploadOptionCachingData.

    Declaration

    Objective-C

    - (void)uploadWithProgress:(void (^_Nullable)(NSInteger))uploadProgressBlock
             completionHandler:
                 (nonnull void (^)(BOOL, NSError *_Nullable))completionHandler;

    Swift

    func upload(progress uploadProgressBlock: ((Int) -> Void)?, completionHandler: @escaping (Bool, Error?) -> Void)

    Parameters

    uploadProgressBlock

    Upload Progress Block.

    completionHandler

    Completion Handler.

  • Upload Method.

    Declaration

    Objective-C

    - (void)uploadWithOption:(LCFileUploadOption)uploadOption
                    progress:(void (^_Nullable)(NSInteger))uploadProgressBlock
           completionHandler:
               (nonnull void (^)(BOOL, NSError *_Nullable))completionHandler;

    Swift

    func upload(with uploadOption: LCFileUploadOption, progress uploadProgressBlock: ((Int) -> Void)?, completionHandler: @escaping (Bool, Error?) -> Void)

    Parameters

    uploadOption
    uploadProgressBlock

    Upload Progress Block.

    completionHandler

    Completion Handler.

  • Download Method. Use default option LCFileDownloadOptionCachedData.

    Declaration

    Objective-C

    - (void)downloadWithCompletionHandler:
        (nonnull void (^)(NSURL *_Nullable, NSError *_Nullable))completionHandler;

    Swift

    func download(completionHandler: @escaping (URL?, Error?) -> Void)

    Parameters

    completionHandler

    Completion Handler.

  • Download Method. Use default option LCFileDownloadOptionCachedData.

    Declaration

    Objective-C

    - (void)downloadWithProgress:(void (^_Nullable)(NSInteger))downloadProgressBlock
               completionHandler:
                   (nonnull void (^)(NSURL *_Nullable,
                                     NSError *_Nullable))completionHandler;

    Swift

    func download(progress downloadProgressBlock: ((Int) -> Void)?, completionHandler: @escaping (URL?, Error?) -> Void)

    Parameters

    downloadProgressBlock

    Download Progress Block.

    completionHandler

    Completion Handler.

  • Download Method.

    Declaration

    Objective-C

    - (void)downloadWithOption:(LCFileDownloadOption)downloadOption
                      progress:(void (^_Nullable)(NSInteger))downloadProgressBlock
             completionHandler:
                 (nonnull void (^)(NSURL *_Nullable,
                                   NSError *_Nullable))completionHandler;

    Swift

    func download(with downloadOption: LCFileDownloadOption, progress downloadProgressBlock: ((Int) -> Void)?, completionHandler: @escaping (URL?, Error?) -> Void)

    Parameters

    downloadOption
    downloadProgressBlock

    Download Progress Block.

    completionHandler

    Completion Handler.

  • Cancel Uploading Task.

    Declaration

    Objective-C

    - (void)cancelUploading;

    Swift

    func cancelUploading()
  • Cancel Downloading Task.

    Declaration

    Objective-C

    - (void)cancelDownloading;

    Swift

    func cancelDownloading()
  • Set a Custom Persistent Cache Directory for files. if not set, LCFile will use a default Persistent Cache Directory.

    Declaration

    Objective-C

    + (void)setCustomPersistentCacheDirectory:(nonnull NSString *)directory;

    Swift

    class func setCustomPersistentCacheDirectory(_ directory: String)

    Parameters

    directory

    Custom Persistent Cache Directory.

  • Clear This file’s Persistent Cache.

    Declaration

    Objective-C

    - (void)clearPersistentCache;

    Swift

    func clearPersistentCache()
  • Clear All file’s Persistent Cache.

    Declaration

    Objective-C

    + (void)clearAllPersistentCache;

    Swift

    class func clearAllPersistentCache()
  • Path of This file’s Persistent Cache.

    Declaration

    Objective-C

    - (NSString *_Nullable)persistentCachePath;

    Swift

    func persistentCachePath() -> String?

    Return Value

    Path.

  • Delete This File Object from server.

    Declaration

    Objective-C

    - (void)deleteWithCompletionHandler:
        (nonnull void (^)(BOOL, NSError *_Nullable))completionHandler;

    Swift

    func delete(completionHandler: @escaping (Bool, Error?) -> Void)

    Parameters

    completionHandler

    Completion Handler.

  • Delete File Object List from server.

    Declaration

    Objective-C

    + (void)deleteWithFiles:(nonnull NSArray<LCFile *> *)files
          completionHandler:
              (nonnull void (^)(BOOL, NSError *_Nullable))completionHandler;

    Swift

    class func delete(with files: [LCFile], completionHandler: @escaping (Bool, Error?) -> Void)

    Parameters

    files

    File Object List

    completionHandler

    Completion Handler.

  • Get File Object from server.

    Declaration

    Objective-C

    + (void)getFileWithObjectId:(nonnull NSString *)objectId
              completionHandler:
                  (nonnull void (^)(LCFile *_Nullable,
                                    NSError *_Nullable))completionHandler;

    Swift

    class func getWithObjectId(_ objectId: String, completionHandler: @escaping (LCFile?, Error?) -> Void)

    Parameters

    objectId

    Object ID.

    completionHandler

    Completion Handler.

  • Undocumented

    Declaration

    Objective-C

    - (nullable NSString *)getThumbnailURLWithScaleToFit:(BOOL)scaleToFit
                                                   width:(int)width
                                                  height:(int)height
                                                 quality:(int)quality
                                                  format:
                                                      (nullable NSString *)format;

    Swift

    func getThumbnailURLWithScale(toFit scaleToFit: Bool, width: Int32, height: Int32, quality: Int32, format: String?) -> String?
  • Undocumented

    Declaration

    Objective-C

    - (nullable NSString *)getThumbnailURLWithScaleToFit:(BOOL)scaleToFit
                                                   width:(int)width
                                                  height:(int)height;

    Swift

    func getThumbnailURLWithScale(toFit scaleToFit: Bool, width: Int32, height: Int32) -> String?
  • Undocumented

    Declaration

    Objective-C

    - (void)getThumbnail:(BOOL)scaleToFit
                   width:(int)width
                  height:(int)height
               withBlock:(nonnull LCIdResultBlock)block;

    Swift

    func getThumbnail(_ scaleToFit: Bool, width: Int32, height: Int32, with block: @escaping LCIdResultBlock)
  • Undocumented

    Declaration

    Objective-C

    + (nonnull LCFileQuery *)query;

    Swift

    class func query() -> LCFileQuery
  • Undocumented

    Declaration

    Objective-C

    - (void)saveInBackgroundWithBlock:(void (^)(BOOL succeeded, NSError * _Nullable error))block;

    Swift

    func saveInBackground(_ block: @escaping (Bool, Error?) -> Void)
  • Undocumented

    Declaration

    Objective-C

    - (void)saveInBackgroundWithBlock:(void (^)(BOOL succeeded, NSError * _Nullable error))block
                        progressBlock:(void (^ _Nullable)(NSInteger number))progressBlock;

    Swift

    func saveInBackground(_ block: @escaping (Bool, Error?) -> Void, progressBlock: ((Int) -> Void)? = nil)
  • Undocumented

    Declaration

    Objective-C

    - (void)setPathPrefix:(NSString *)prefix;

    Swift

    func setPathPrefix(_ prefix: String)
  • Undocumented

    Declaration

    Objective-C

    - (void)clearPathPrefix;

    Swift

    func clearPathPrefix()