Created
February 13, 2021 15:44
-
-
Save thatswiftguy/9325e74b2c37a51524b035ffeba9996b to your computer and use it in GitHub Desktop.
This Function Will Fetch the All Recordings from system to Array
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 fetchAllRecording(){ | |
let path = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0] | |
let directoryContents = try! FileManager.default.contentsOfDirectory(at: path, includingPropertiesForKeys: nil) | |
for i in directoryContents { | |
recordingsList.append(Recording(fileURL : i, createdAt:getFileDate(for: i), isPlaying: false)) | |
} | |
recordingsList.sort(by: { $0.createdAt.compare($1.createdAt) == .orderedDescending}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment