Comments (7)
Folder.documents, and Folder.library are macOS only for some reason.
I use extension to add them back to use in iOS. maybe you can do the same.
#if os(iOS)
extension Folder {
static var documents: Folder? {
let urls = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)
guard let url = urls.first else { return nil }
return try? Folder(path: url.relativePath)
}
/// The current user's Library folder
static var library: Folder? {
let urls = FileManager.default.urls(for: .libraryDirectory, in: .userDomainMask)
guard let url = urls.first else { return nil }
return try? Folder(path: url.relativePath)
}
}
#endif
from files.
Awesome. Thanks!
I'd kind of like to get a comment from @JohnSundell - I'd be interested why this was made only for macOS, and if it was done for good reason. I'd like to fix it in the library itself if possible. Thanks for commenting, I didn't take the time to look at the code :)
from files.
@princegeovision do both of these work? I didn't know there was a library folder on iOS.
from files.
Well, I never use "library" as well, but apparently it has.
library = Folder(name: Library, path: /Users/xxxxxxxxxx/Library/Developer/CoreSimulator/Devices/AC788231-BC9D-4C31-A32A-C580AEBD2659/data/Containers/Data/Application/0F0BC8D9-32D5-46B8-A396-1B9C79D3A5EA/Library/)
documents = Folder(name: Documents, path: /Users/xxxxxxxxxx/Library/Developer/CoreSimulator/Devices/AC788231-BC9D-4C31-A32A-C580AEBD2659/data/Containers/Data/Application/0F0BC8D9-32D5-46B8-A396-1B9C79D3A5EA/Documents/)
from files.
@princegeovision You can make a pull requet, hope @JohnSundell can make it the offical
from files.
let documents = try! Folder.home.subfolder(named: "Documents")
from files.
Feel free to make a PR if you'd like to see these APIs added on iOS
from files.
Related Issues (20)
- 'NSWorkspace' is unavailable in Mac Catalyst HOT 3
- Examples are buggy HOT 2
- Using the Swift Package Manager - Getting Error HOT 2
- nameExcludingExtension removes all "." HOT 2
- Throwing function never throws
- Hello. Why there is no .documents and .library folder for iOS builds? HOT 4
- How can I move a file to a new folder with a new name atomically?
- Subfolder on iOS is returning empty while on Mac returns content HOT 1
- Get File Size HOT 1
- Example of use with (or instead of) fileImporter?
- Is there a way to get file metadata such as modification date?
- Hidden subfolders are not listed in `subfolders` property HOT 1
- Unable to get hidden files
- "\" characters confuse "Folder.subfolders" HOT 2
- Usb
- This may reduce the quality of type information available
- Try? thread exception issue with XCode 14.3 and Release
- Heads-up: The next major version (5.0) will drop CocoaPods + Carthage support HOT 1
- Folder(path: <path>) doesn't seem to work HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from files.