Skip to content

Instantly share code, notes, and snippets.

@DrBeta
Created Jan 26, 2019
Embed
What would you like to do?
This is a easy to use function that you can add to any swift code that waits for a time you specify in the "time" parameter.
// Created by Dr.Beta
import Foundation
import UIKit
//Put the amount of seconds in the 'time' parameter.
func wait(time: UInt32) {
sleep(time)
}
//This line waits for 4 seconds
wait(time: 4)
//Now do whatever you want, in this case I print "It has been 4 seconds".
print("It has been 4 seconds")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment