In accordance with this brilliant answer to using dispatch_after by @matt, I tried the code on the playground and it works fine (no errors). But when I try to do backward compatibility, since DispatchTime.now() is only available for iOS 10 only like this:
func delay( _ delay: Double, closure: () -> ()){ guard
The compiler offers to fix DISPATCH_TIME_NOW to Replace "DISPATCH_TIME_NOW" with "dispatch_time_t(DISPATCH_TIME_NOW)" and gives an error message
Cannot convert value of type 'Int' to the expected argument type 'dispatch_time_t' (aka 'UInt64')
I tried to fix it as a compiler, but finally ended up with a lot of errors. How do I use backward compatibility here? What bad am I doing? Help, thanks!
ios swift swift3 xcode8
Dershitzitz123
source share