🗃️FileManager
document directory vs. bundle resources
document directory: user contents, read/write.
bundle resources: app files, readonly.
all iOS apps are sandboxed, which means they run in their own container with a hard to guess directory name. As a result, we can’t (and shouldn’t try to) guess the directory where our app is installed, and instead need to rely on Apple’s API for finding our app’s documents directory.
📗 參考: File System Programming Guide
read: 👁️ , write: ➕(new), ➖(delete), 📝(edit), 📁(new subfolder)
---------------------------------------------------------------------
directory 👁️➕➖📝 📁 description
---------------------------------------------------------------------
<AppName>.app ✅❌❌❌ ❌ app’s bundle (app's files & resources)
Documents ✅✅✅✅ ✅ user files
└ Inbox ✅❌✅❌ ❌ files app was asked to open
Library ✅✅✅✅ ✅ any non-user files
├ Caches data used to improve performance
└ Application Support files app uses to run
tmp ✅✅✅✅ ✅ temporary files
---------------------------------------------------------------------
Foundation ⟩ File System ⟩ FileManager ⟩
urls(for:in:) - locate common directories.
Swift Playgrounds ⟩ Image Gallery (Data Model: Gathering Image URLs)
AppyPie ⟩ Working with Files on iOS with Swift ⭐️
Sundell ⟩ Working with files and folders in Swift
Pursuit Core iOS ⟩ Persisting Custom Objects to Documents Directory
app resources are stored in Bundle.
Last updated
Was this helpful?