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
-
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 }
-
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 }
-
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() async throws -> Bool
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)?) async throws -> Bool
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)?) async throws -> Bool
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() async throws -> URL
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)?) async throws -> URL
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)?) async throws -> URL
Parameters
downloadOption
See
LCFileDownloadOption
.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() async throws -> Bool
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]) async throws -> Bool
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 withObjectId(_ objectId: String) async throws -> LCFile
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
-
Undocumented
Declaration
Objective-C
- (void)saveInBackgroundWithBlock:(void (^)(BOOL succeeded, NSError * _Nullable error))block;
Swift
func saveInBackground() async throws -> Bool
-
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()