I Download pdf file Like This And Saved the Path in Userdefault var documents = PDFDocument
let documentsPath = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0]
let fileName = urlString as NSString;
var arrayUrl = [String]()
arrayUrl.append(filePath)
self.defaults.set(arrayUrl, forKey: Constants.myKeyURL)
The First Time when App Run This documents get Value Well But Next Time When I don't need to Download Again documents it's Null but The ArrayURL ints same Value !!
var arrayUrl = [String]()
self.defaults.stringArray(forKey: Constants.myKeyURL)
arrayUrl = self.defaults.stringArray(forKey: Constants.myKeyURL)!
self.documents = arrayUrl.flatMap { PDFDocument(url: URL(fileURLWithPath: $0) ) }
print(self.documents)
DispatchQueue.main.async {
self.tableView.reloadData()
}