Skip to content

Commit 8d92bbc

Browse files
committed
Added Swift nullability specifiers.
1 parent 3b79610 commit 8d92bbc

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

LSFileWrapper.h

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,20 @@ FOUNDATION_EXPORT const unsigned char LSFileWrapperVersionString[];
2525
/**
2626
* @brief Initializes a new LSFileWrapper of type File.
2727
*/
28-
- (id)initFile;
28+
- (nonnull id)initFile;
2929

3030
/**
3131
* @brief Initializes a new LSFileWrapper of type Directory.
3232
*/
33-
- (id)initDirectory;
33+
- (nonnull id)initDirectory;
3434

3535
/**
3636
* @brief Loads and initializes LSFileWrapper with the contents of supplied url.
3737
*
3838
* @param url The origin url from which LSFileWrapper should be loaded.
3939
* @param isDir Boolean indicating whether the passed url is a Directory. When unknown NO should be passed, as the method will automatically detect the correct wrapper type based on the supplied url.
4040
*/
41-
- (id)initWithURL:(NSURL *)url isDirectory:(BOOL)isDir;
41+
- (nullable id)initWithURL:(nonnull NSURL *)url isDirectory:(BOOL)isDir;
4242

4343
// MARK: - File Wrapper Methods
4444

@@ -49,7 +49,7 @@ FOUNDATION_EXPORT const unsigned char LSFileWrapperVersionString[];
4949
*
5050
* @return Stored data in the current LSFileWrapper as NSString.
5151
*/
52-
- (NSData *)data;
52+
- (nullable NSData *)data;
5353

5454
/**
5555
* @brief Loads and returns the stored data as NSString.
@@ -58,7 +58,7 @@ FOUNDATION_EXPORT const unsigned char LSFileWrapperVersionString[];
5858
*
5959
* @return Stored data in the current LSFileWrapper as NSString.
6060
*/
61-
- (NSString *)string;
61+
- (nullable NSString *)string;
6262

6363
/**
6464
* @brief Loads and returns the stored data as NSDictionary.
@@ -67,7 +67,7 @@ FOUNDATION_EXPORT const unsigned char LSFileWrapperVersionString[];
6767
*
6868
* @return Stored data in the current LSFileWrapper as NSDictionary.
6969
*/
70-
- (NSDictionary *)dictionary;
70+
- (nullable NSDictionary *)dictionary;
7171

7272
#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
7373
/**
@@ -77,7 +77,7 @@ FOUNDATION_EXPORT const unsigned char LSFileWrapperVersionString[];
7777
*
7878
* @return Stored data in the current LSFileWrapper as UIImage.
7979
*/
80-
- (UIImage *)image;
80+
- (nullable UIImage *)image;
8181
#else
8282
/**
8383
* @brief Loads and returns the stored data as NSImage.
@@ -86,7 +86,7 @@ FOUNDATION_EXPORT const unsigned char LSFileWrapperVersionString[];
8686
*
8787
* @return Stored data in the current LSFileWrapper as NSImage.
8888
*/
89-
- (NSImage *)image;
89+
- (nullable NSImage *)image;
9090
#endif
9191

9292
/**
@@ -96,7 +96,7 @@ FOUNDATION_EXPORT const unsigned char LSFileWrapperVersionString[];
9696
*
9797
* @param content New contents to store.
9898
*/
99-
- (void)updateContent:(id<NSObject>)content;
99+
- (void)updateContent:(nonnull id<NSObject>)content;
100100

101101
/**
102102
* @brief Clears currently stored contents.
@@ -122,7 +122,7 @@ FOUNDATION_EXPORT const unsigned char LSFileWrapperVersionString[];
122122
*
123123
* @return Optional stored child wrapper as LSFileWrapper.
124124
*/
125-
- (LSFileWrapper *)fileWrapperWithPath:(NSString *)path;
125+
- (nullable LSFileWrapper *)fileWrapperWithPath:(nonnull NSString *)path;
126126

127127
/**
128128
* @brief Finds child wrapper at supplied path in the current LSFileWrapper and its children traversing by path.
@@ -135,7 +135,7 @@ FOUNDATION_EXPORT const unsigned char LSFileWrapperVersionString[];
135135
*
136136
* @return Optional stored child wrapper as LSFileWrapper.
137137
*/
138-
- (LSFileWrapper *)fileWrapperWithPath:(NSString *)path create:(BOOL)create isDirectory:(BOOL)isDir;
138+
- (nullable LSFileWrapper *)fileWrapperWithPath:(nonnull NSString *)path create:(BOOL)create isDirectory:(BOOL)isDir;
139139

140140
/**
141141
* @brief Adds a new child wrapper with the supplied name to the current LSFileWrapper. If a wrapper is already present with the same name, then the new wrapper will be saved under the returned named to prevent collisions.
@@ -148,7 +148,7 @@ FOUNDATION_EXPORT const unsigned char LSFileWrapperVersionString[];
148148
*
149149
* @return Nil on error or the name of the added child wrapper as NSString.
150150
*/
151-
- (NSString *)addFileWrapper:(LSFileWrapper *)fileWrapper withFilename:(NSString *)filename;
151+
- (nonnull NSString *)addFileWrapper:(nonnull LSFileWrapper *)fileWrapper withFilename:(nonnull NSString *)filename;
152152

153153
/**
154154
* @brief Adds a new child wrapper with the supplied name to the current LSFileWrapper. If a wrapper is already present with the same name, then the new wrapper will replace it.
@@ -159,7 +159,7 @@ FOUNDATION_EXPORT const unsigned char LSFileWrapperVersionString[];
159159
* @param fileWrapper Child wrapper which should be stored in the current LSFileWrapper as LSFileWrapper.
160160
* @param filename Name of the child wrapper.
161161
*/
162-
- (void)setFileWrapper:(LSFileWrapper *)fileWrapper withFilename:(NSString *)filename;
162+
- (void)setFileWrapper:(nonnull LSFileWrapper *)fileWrapper withFilename:(nonnull NSString *)filename;
163163

164164
/**
165165
* @brief Removes the supplied child wrapper from the current LSFileWrapper.
@@ -168,7 +168,7 @@ FOUNDATION_EXPORT const unsigned char LSFileWrapperVersionString[];
168168
*
169169
* @param fileWrapper Child wrapper which should be added to current LSFileWrapper as LSFileWrapper.
170170
*/
171-
- (void)removeFileWrapper:(LSFileWrapper *)fileWrapper;
171+
- (void)removeFileWrapper:(nonnull LSFileWrapper *)fileWrapper;
172172

173173
/**
174174
* @brief Adds a new child wrapper of type File with the supplied name to the current LSFileWrapper. If a wrapper is already present with the same name, then the new wrapper will be saved under the returned named to prevent collisions.
@@ -181,7 +181,7 @@ FOUNDATION_EXPORT const unsigned char LSFileWrapperVersionString[];
181181
*
182182
* @return Nil on error or the name of the added child file wrapper as NSString.
183183
*/
184-
- (NSString *)addContent:(id<NSObject>)content_ withFilename:(NSString *)filename;
184+
- (nonnull NSString *)addContent:(nonnull id<NSObject>)content_ withFilename:(nonnull NSString *)filename;
185185

186186
/**
187187
* @brief Adds a new child wrapper of type File with the supplied name to the current LSFileWrapper. If a wrapper is already present with the same name, then the new wrapper will replace it.
@@ -192,7 +192,7 @@ FOUNDATION_EXPORT const unsigned char LSFileWrapperVersionString[];
192192
* @param content_ Content which should be stored in the current LSFileWrapper.
193193
* @param filename Name of the child file wrapper.
194194
*/
195-
- (void)setContent:(id<NSObject>)content_ withFilename:(NSString *)filename;
195+
- (void)setContent:(nonnull id<NSObject>)content_ withFilename:(nonnull NSString *)filename;
196196

197197
// MARK: - Disk Write Methods
198198

@@ -206,7 +206,7 @@ FOUNDATION_EXPORT const unsigned char LSFileWrapperVersionString[];
206206
*
207207
* @return Boolean indicating success or failure of the write operation.
208208
*/
209-
- (BOOL)writeUpdatesToURL:(NSURL *)url error:(NSError *__autoreleasing *)outError;
209+
- (BOOL)writeUpdatesToURL:(nonnull NSURL *)url error:(NSError *__autoreleasing _Nullable *_Nullable)outError;
210210

211211
/**
212212
* @brief Writes all contents of LSFileWrapper to passed url.
@@ -218,7 +218,7 @@ FOUNDATION_EXPORT const unsigned char LSFileWrapperVersionString[];
218218
*
219219
* @return Boolean indicating success or failure of the write operation.
220220
*/
221-
- (BOOL)writeToURL:(NSURL *)url error:(NSError *__autoreleasing *)outError;
221+
- (BOOL)writeToURL:(nonnull NSURL *)url error:(NSError *__autoreleasing _Nullable *_Nullable)outError;
222222

223223
#if TARGET_OS_OSX
224224
/**
@@ -236,15 +236,15 @@ FOUNDATION_EXPORT const unsigned char LSFileWrapperVersionString[];
236236
*
237237
* @return Boolean indicating success or failure of the write operation.
238238
*/
239-
- (BOOL)writeToURL:(NSURL *)url forSaveOperation:(NSSaveOperationType)saveOperation originalContentsURL:(NSURL *)absoluteOriginalContentsURL backupDocumentURL:(NSURL *)backupFileURL error:(NSError *__autoreleasing *)outError;
239+
- (BOOL)writeToURL:(nonnull NSURL *)url forSaveOperation:(NSSaveOperationType)saveOperation originalContentsURL:(nullable NSURL *)absoluteOriginalContentsURL backupDocumentURL:(nullable NSURL *)backupFileURL error:(NSError *__autoreleasing _Nullable *_Nullable)outError;
240240
#endif
241241

242242
// MARK: - Instance Properties
243243

244-
@property (readonly, strong, nonatomic) NSString *filename;
245-
@property (readonly, strong, nonatomic) NSString *fileType;
246-
@property (readonly, strong, nonatomic) NSMutableDictionary<NSString*, LSFileWrapper*> *fileWrappers;
247-
@property (readonly, strong, nonatomic) NSURL *writtenURL;
244+
@property (readonly, strong, nonatomic, nullable) NSString *filename;
245+
@property (readonly, strong, nonatomic, nullable) NSString *fileType;
246+
@property (readonly, strong, nonatomic, nullable) NSMutableDictionary<NSString*, LSFileWrapper*> *fileWrappers;
247+
@property (readonly, strong, nonatomic, nullable) NSURL *writtenURL;
248248
@property (readonly, nonatomic) BOOL updated;
249249
@property (readonly, nonatomic) BOOL isDirectory;
250250
@property (assign, nonatomic) NSInteger reserve;

0 commit comments

Comments
 (0)