I've been trying to use contentsOfDirectory to access the MOV files in the documents folder. However it won't work. Here's my script:
- let docDir = try! FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: true)
- let filePath = try! FileManager.default.contentsOfDirectory(at: docDir, includingPropertiesForKeys: nil)
I get the error message "Cannot use instance member 'docDir' within property initializer; propery initializers run before 'self' is available" in my filePath variable. Why am I getting this?