Skip to content

Instantly share code, notes, and snippets.

@DrBeta
Created January 26, 2019 00:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DrBeta/ce19cfb2a816c7a08436d475472c34d9 to your computer and use it in GitHub Desktop.
Save DrBeta/ce19cfb2a816c7a08436d475472c34d9 to your computer and use it in GitHub Desktop.
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