I have a class that I used for my android implementation that reads and writes to text files on the device using File, FileWriter, and Scanner. For android, the file path was context.getFilesDir(). How do I do the same on iOS?
I used this piece of code which worked for me:
NSArray paths = Foundation.NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory.DocumentDirectory, NSSearchPathDomainMask.UserDomainMask, true); String path = (String) paths.firstObject();
But if you have a look at the docs there is another method mentioned: https://moe.noisyfox.io/doc/multi-os-engine/7_creating_db_app/1_part1/part1.html
According to the Apple docs (https://developer.apple.com/documentation/foundation/1414224-nssearchpathfordirectoriesindoma) the second method should be the prefered one, but I think both will work.