-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathICACloud.h
53 lines (36 loc) · 1.98 KB
/
ICACloud.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//
// ICACloud
// iCloud Access
//
// Created by Drew McCormack on 18/01/14.
// Copyright (c) 2014 Drew McCormack. All rights reserved.
//
#import <Foundation/Foundation.h>
extern NSString *ICAException;
extern NSString *ICAErrorDomain;
typedef NS_ENUM(NSInteger, ICAErrorCode) {
ICAErrorCodeFileAccessFailed = 100,
ICAErrorCodeFileCoordinatorTimedOut = 101,
ICAErrorCodeAuthenticationFailure = 102,
ICAErrorCodeConnectionError = 103
};
@interface ICACloudFile : NSObject
@property (readonly, copy) NSString *path;
@property (readonly, copy) NSString *name;
@property (readonly) NSDictionary *fileAttributes;
@end
@interface ICACloud : NSObject
@property (nonatomic, assign, readonly) BOOL isConnected;
@property (nonatomic, strong, readonly) id <NSObject, NSCopying, NSCoding> identityToken; // Fires KVO Notifications
@property (nonatomic, readonly) NSString *rootDirectoryPath; // Container relative
- (instancetype)initWithUbiquityContainerIdentifier:(NSString *)newIdentifier;
- (instancetype)initWithUbiquityContainerIdentifier:(NSString *)newIdentifier rootDirectoryPath:(NSString *)newPath;
- (void)fileExistsAtPath:(NSString *)path completion:(void(^)(BOOL exists, BOOL isDirectory, NSError *error))block;
- (void)createDirectoryAtPath:(NSString *)path completion:(void(^)(NSError *error))block;
- (void)contentsOfDirectoryAtPath:(NSString *)path completion:(void(^)(NSArray *contents, NSError *error))block;
- (void)removeItemAtPath:(NSString *)fromPath completion:(void(^)(NSError *error))block;
- (void)uploadLocalFile:(NSString *)fromPath toPath:(NSString *)toPath completion:(void(^)(NSError *error))block;
- (void)downloadFromPath:(NSString *)fromPath toLocalFile:(NSString *)toPath completion:(void(^)(NSError *error))block;
- (void)uploadData:(NSData *)data toPath:(NSString *)toPath completion:(void(^)(NSError *error))block;
- (void)downloadDataFromPath:(NSString *)fromPath completion:(void(^)(NSData *data, NSError *error))block;
@end