@@ -201,12 +201,12 @@ public struct File {
201201 - Parameter completion: An optional completion block when the operation
202202 is done.
203203 */
204- public static func removeItemAtPath( _ path: URL , completion: ( ( removed : Bool ? , error : Error ? ) -> Void ) ? = nil ) {
204+ public static func removeItemAtPath( _ path: URL , completion: ( ( Bool ? , Error ? ) -> Void ) ? = nil ) {
205205 do {
206206 try FileManager . default. removeItem ( atPath: path. path)
207- completion ? ( removed : true , error : nil )
207+ completion ? ( true , nil )
208208 } catch let e as NSError {
209- completion ? ( removed : nil , error : e)
209+ completion ? ( nil , e)
210210 }
211211 }
212212
@@ -218,12 +218,12 @@ public struct File {
218218 - Parameter completion: An optional completion block when the operation
219219 is done.
220220 */
221- public static func createDirectoryAtPath( _ path: URL , withIntermediateDirectories createIntermediates: Bool , attributes: [ String : AnyObject ] ? , completion: ( ( success : Bool , error : Error ? ) -> Void ) ? = nil ) {
221+ public static func createDirectoryAtPath( _ path: URL , withIntermediateDirectories createIntermediates: Bool , attributes: [ String : Any ] ? , completion: ( ( Bool , Error ? ) -> Void ) ? = nil ) {
222222 do {
223223 try FileManager . default. createDirectory ( atPath: path. path, withIntermediateDirectories: createIntermediates, attributes: attributes)
224- completion ? ( success : true , error : nil )
224+ completion ? ( true , nil )
225225 } catch let e as NSError {
226- completion ? ( success : false , error : e)
226+ completion ? ( false , e)
227227 }
228228 }
229229
@@ -233,12 +233,12 @@ public struct File {
233233 - Parameter completion: An optional completion block when the operation
234234 is done.
235235 */
236- public static func removeDirectoryAtPath( _ path: URL , completion: ( ( success : Bool , error : Error ? ) -> Void ) ? = nil ) {
236+ public static func removeDirectoryAtPath( _ path: URL , completion: ( ( Bool , Error ? ) -> Void ) ? = nil ) {
237237 do {
238238 try FileManager . default. removeItem ( at: path)
239- completion ? ( success : true , error : nil )
239+ completion ? ( true , nil )
240240 } catch let e as NSError {
241- completion ? ( success : false , error : e)
241+ completion ? ( false , e)
242242 }
243243 }
244244
@@ -249,12 +249,12 @@ public struct File {
249249 - Parameter completion: An optional completion block when the operation
250250 is done.
251251 */
252- public static func contentsOfDirectoryAtPath( _ path: URL , shouldSkipHiddenFiles skip: Bool = false , completion: ( ( contents : [ URL ] ? , error : Error ? ) -> Void ) ) {
252+ public static func contentsOfDirectoryAtPath( _ path: URL , shouldSkipHiddenFiles skip: Bool = false , completion: ( ( [ URL ] ? , Error ? ) -> Void ) ) {
253253 do {
254254 let contents = try FileManager . default. contentsOfDirectory ( at: path, includingPropertiesForKeys: nil , options: skip == true ? FileManager . DirectoryEnumerationOptions. skipsHiddenFiles : FileManager . DirectoryEnumerationOptions ( rawValue: 0 ) )
255- completion ( contents: contents , error : nil )
255+ completion ( contents, nil )
256256 } catch let e as NSError {
257- return completion ( contents : nil , error : e)
257+ return completion ( nil , e)
258258 }
259259 }
260260
@@ -266,12 +266,12 @@ public struct File {
266266 - Parameter completion: An optional completion block when the operation
267267 is done.
268268 */
269- public static func writeToPath( _ path: URL , name: String , value: String , completion: ( ( success : Bool , error : Error ? ) -> Void ) ? = nil ) {
269+ public static func writeToPath( _ path: URL , name: String , value: String , completion: ( ( Bool , Error ? ) -> Void ) ? = nil ) {
270270 do {
271271 try value. write ( to: path. appendingPathComponent ( " / \( name) " ) , atomically: true , encoding: String . Encoding. utf8)
272- completion ? ( success : true , error : nil )
272+ completion ? ( true , nil )
273273 } catch let e as NSError {
274- completion ? ( success : false , error : e)
274+ completion ? ( false , e)
275275 }
276276 }
277277
@@ -281,11 +281,11 @@ public struct File {
281281 - Parameter completion: An optional completion block when the operation
282282 is done.
283283 */
284- public static func readFromPath( _ path: URL , completion: ( ( string : String ? , error : Error ? ) -> Void ) ) {
284+ public static func readFromPath( _ path: URL , completion: ( ( String ? , Error ? ) -> Void ) ) {
285285 if let data = try ? Data ( contentsOf: path) {
286- completion ( string : String ( data: data, encoding: String . Encoding. utf8) , error : nil )
286+ completion ( String ( data: data, encoding: String . Encoding. utf8) , nil )
287287 } else {
288- completion ( string : nil , error : NSError ( domain: " io.graph .File " , code: 0 , userInfo: nil ) )
288+ completion ( nil , NSError ( domain: " io.cosmicmind.Graph .File " , code: 0 , userInfo: nil ) )
289289 }
290290 }
291291
0 commit comments