Swift 1.2 で開発された古い iOS アプリケーションがあります。その中で、実行時間を短縮するためにディスパッチキューを使用しました。
dispatch_async(dispatch_get_main_queue()) {
}
Swift 4では、以下のように変更してみました
DispatchQueue.main.async { [weak self] in
if let strongSelf = self {
strongSelf.imapFetchFoldersOp?.start({ (error, folders) -> Void in
if let error = error {
#if DEBUG
print("\(String(describing: error._userInfo))")
#endif
} else {
strongSelf.folders = folders! as NSArray
strongSelf.fetchInfoForBoxes()
print("Floders :\(folders!)")
}
})
}
}
私はそれを正しく行いましたか、それとも変更する必要がありますか?