You can find the size of a csv file using FileManager in Swift by following these steps:
Here's the code:
main.swift304 chars11 lines
In the code above, we first define filePath
as the path to the csv file. Then, we try to get the attributes of the file using FileManager. If successful, we retrieve the size
attribute from the attributes dictionary and cast it to an Int64
. Finally, we convert the size to MB and print it to the console.
gistlibby LogSnag