我一直在转换为新的swift语法。我无法将第三方SQLITE派对调整到Swift 3.0中。似乎关闭了一个更新:https://github.com/apple/swift-evolution/blob/master/proposals/0103-make-noescape-default.md
我不知道我的生活中如何将变量“task”传递给我的函数以添加到GCD队列这是我的函数调用我的函数“put on thread”时的代码。
let foo: ()->Void = {
let interesting = "confusing"
print("Swift 3.0 Conversion has been " + interesting + " with some parts!")
}
/// Compiler error: Cannot convert value of type () -> Void to expected argument SwiftData
putOnThread(foo)
///I have also tried this and I get a different compiler error:
SwiftData.putOnThread(foo)
//Compiler error: Use an instance member 'putOnThread' on type 'SwiftData'. Did you mean to use a value type of SwiftData instead?
这是putOnThread方法的样子:
extension SwiftData {
public func putOnThread(closure: @escaping ()->Void) {
SQLiteDB.sharedInstance.queue.sync {
closure()
}
}
}
注意:SwiftData是一个结构。任何帮助将不胜感激!也许一旦我完成,我可以愉快地将我的Swift 3.0更改提交回github!