Skip to content

Instantly share code, notes, and snippets.

@thatswiftguy
Created February 13, 2021 15:44
Show Gist options
  • Save thatswiftguy/9325e74b2c37a51524b035ffeba9996b to your computer and use it in GitHub Desktop.
Save thatswiftguy/9325e74b2c37a51524b035ffeba9996b to your computer and use it in GitHub Desktop.
This Function Will Fetch the All Recordings from system to Array
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