writeToFile how to tell when it is completed

前端 未结 2 393
误落风尘
误落风尘 2021-01-17 11:11

I\'m doing some writing of data to my documents directory and I was wondering if there is a way to tell when my writeToFile method completes and the file I am creating has b

2条回答
  •  鱼传尺愫
    2021-01-17 11:27

    Swift 5:

    do {
        try data.write(to: path)
        // here's when write operation is completed without errors thrown
    } catch {
        Swift.print(error)
    }
    

提交回复
热议问题