Inspired by Obsidian, I am trying to build a iOS and MacOS journaling app that stores entries as Markdown files. The idea being that the Markdown format is future proof and if entries are stored in the user's file system, they will own their data. So the app I wanted to build would need to create, read, update, and delete markdown files in a directory provided by the user.
User interface example:
File structure example:
/directory-provided-by-user
--> 202203050000.md
--> 202203040000.md
--> 202203030000.md
--> 202203020000.md
I also wanted there to be an iOS and MacOS app so that entries could be created on the fly in mobile, but also on one's computer. This would mean the files would have to sync across devices and I thought iCloud would be a good option for that.
The problem I am running into is accessing files in iCloud Drive. iOS apps are sandboxed and I haven't found a good example of how to access a directory of files outside that sandbox. I have found a couple of options for MacOS but nothing that's easy to grasp. Also I have looked for Atom of Sublime clones in Swift, with no luck.
I liked the idea of document-based apps in SwiftUI, but this app is meant to work with a collection of entries, not just one entry at a time. From what I can tell, document-based apps are good for application like Pages, where each document can stand on its own. The journaling app is meant to be a collection of entries and offer features like sort, search, review random entry, etc.
Questions I could use help with are:
- How can an app be granted access to user, not sandbox, iCloud files? And once granted how does an app perform CRUD actions on those files?
- If that is not posible, what options are there for writing to user accessible files, but also syncing them across mobile and desktop?