[swift-users] Migrating to Swift 3 Dispatch
thierry.passeron at gmail.com
Sun Oct 16 13:25:55 CDT 2016
I’m in the process of migrating older code to Swift 3 and I’m stuck on this one.
How do you create a timer dispatch source?
let source = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, queue)
dispatch_source_set_timer(source, dispatch_time(DISPATCH_TIME_NOW, 0), UInt64(interval * 1000_000_000), 0)
// Do something useful
Xcode is not helping me with any of the required refactoring. The convert tool throws many errors but no proposition.
I have tried to explore the New Dispatch headers with no luck. DISPATCH_SOURCE_TYPE_TIMER can’t be found… ok so It seems to be replaced with a protocol DispatchSourceTimer and … no initializer… I think I don’t yet catch with the whole philosophy of this new version.
I’d be pleased if anyone cared to enlighten me.
Thanks and regards,
More information about the swift-users