How to write dispatch after GCD in iOS swift?

Solution:

Using GCD below are the three methods after few milliseconds or microseconds or nanoseconds.


        DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(500)) {
            print("after milliseconds")
        }
        
        DispatchQueue.main.asyncAfter(deadline: .now() + .microseconds(1000)) {
            print("after microseconds")

        }
        
        DispatchQueue.main.asyncAfter(deadline: .now() + .nanoseconds(10000000)) {
            print("after nano seconds")

        }

Comments

Popular posts from this blog

Invalid bundle error while upload the app to the app Store

Convert NsNumber, NSDate to String in iOS Swift

Global LocationManager Singleton class iOS Swift