I was under the impression that only UI work that is done to alter UI on the screen needs to be on the main thread. I was wondering if even using UIkit component api’s are required to, to ensure thread safety
<code>func checkIfUIisVisible() {
DispatchQueue.main.async {
if self.view.window != nil {
// The view is currently visible on the screen
print("UI is visible")
} else {
// The view is not visible
print("UI is not visible")
}
}
}
</code>
<code>func checkIfUIisVisible() {
DispatchQueue.main.async {
if self.view.window != nil {
// The view is currently visible on the screen
print("UI is visible")
} else {
// The view is not visible
print("UI is not visible")
}
}
}
</code>
func checkIfUIisVisible() {
DispatchQueue.main.async {
if self.view.window != nil {
// The view is currently visible on the screen
print("UI is visible")
} else {
// The view is not visible
print("UI is not visible")
}
}
}
Expecting it to work the same without having to execute on the main thread.