Following the recommendation from https://stackoverflow.com/a/27712427/3286489, I can perform asynchronous download as below, and it is called during viewDidLoad.
    func loadItems(tuple : (name : String, imageURL : URL)) {
        print("Download Started")
        URLSession.shared.dataTask(with: tuple.imageURL, completionHandler :
        { data, response, error in
            guard let data = data, error == nil else { return }
            print(response?.suggestedFilename ?? tuple.imageURL.lastPathComponent)
            print("Download Finished")
            DispatchQueue.main.async() { [weak self] in
                self?.displayFlag(data: data, title: tuple.name)
            }
        }).resume()
    }
This all works well. My question is, in the event of a slow download, and I exit the page, how and where (viewDidUnload? looks that that is deprecated already) can I cancel the fetching (image downloading) task?
 
    