Created
September 2, 2018 21:45
-
-
Save erdemarslan/8d2b116c86ff755c9d447e02b6ddd74c 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
| let filemanager = FileManager.default | |
| var isDir : ObjCBool = false | |
| let filename = "test" | |
| let fileExtension = "txt" | |
| var dir = try? filemanager.url(for: .cachesDirectory, in: .userDomainMask, appropriateFor: nil, create: true) | |
| dir!.appendPathComponent(filename) | |
| dir!.appendPathExtension(fileExtension) | |
| if filemanager.fileExists(atPath: dir!.path, isDirectory: &isDir) { | |
| if isDir.boolValue { | |
| print("var ve bu bir klasör") | |
| } else { | |
| print("var ve bu bir dosya") | |
| } | |
| } else { | |
| print("dosya veya klasör yok!") | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment