Last active
March 17, 2021 09:27
-
-
Save olbrichj/b0ba51fa274df114c98f4744aa813c38 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func executeOnMain() { | |
if !Thread.isMainThread { | |
DispatchQueue.main.async(execute: {() -> Void in | |
executeOnMain() | |
}) | |
return | |
} | |
// do something | |
} |
It is still wrong. It should read:
func executeOnMain() {
if !Thread.isMainThread {
DispatchQueue.main.async(execute: {() -> Void in
executeOnMain()
})
return
}
// do something
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
updated. sry it took so long