// // DispatchQueue+Extensions.swift // LMS // // Created by Suraj Kumar Mandal on 05/09/22. // import Foundation typealias Dispatch = DispatchQueue extension Dispatch { static func background(_ task: @escaping () -> ()) { Dispatch.global(qos: .background).async { task() } } static func main(_ task: @escaping () -> ()) { Dispatch.main.async { task() } } } //Usage /* Dispatch.background { // do stuff Dispatch.main { // update UI } } */