I use the function of Parsing data from the site
func pars(arg: Bool, completion: (Bool) -> ()) { do { myURL = URL(string: "https:_______") let html = try! String(contentsOf: myURL!, encoding: .utf8) let doc: Document = try SwiftSoup.parse(html) let body = doc.body() name = (try body?.select(".name"))! completion(arg) } catch Exception.Error(let type, let message) { print(message) } catch { print("error") } } But when you minimize the application often crashes, since the data can not be loaded. so, is it possible to stop the function or continue its execution but already in the background?