Created
October 1, 2019 17:19
-
-
Save PetreVane/e75012d3b0123c1fe32e78439c924305 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func fetchImageWithFileManager(image: String) -> UIImage? { | |
if let pathUrl = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0] { | |
let dirURL = pathUrl.appendingPathComponent(image) | |
do { | |
let imageData = try Data(contentsOf: dirURL) | |
return UIImage(data: imageData) | |
} catch { | |
print("Failed loading image") | |
} | |
} | |
return nil | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment