> For the complete documentation index, see [llms.txt](https://sagar-r-kothari.gitbook.io/blog/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sagar-r-kothari.gitbook.io/blog/_posts/2020-02-14-swift-performtaskinbackground.md).

# 2020-02-14-Swift-PerformTaskInBackground

```swift
func someFunctionhere() {
    // perform something on background thread
  DispatchQueue.global(qos: .background).async {
    // perform background tasks here


    // Now switch back to Main Thread for UI Operations
    DispatchQueue.main.async {
        // Update UI here
      MBProgressHUD.hide(for: hudView, animated: false)
    }
  }
}
```
