The markdown parsing is broken/disabled for release notes. Sorry about that, I'm chasing the source of a crash that's been bringing this website down for the last couple of days.
- You can now easily check if a `Folder` is empty using the `isEmpty()` method.
- `Folder.documents` and `Folder.library` are now both available on iOS and tvOS, as well as macOS.
- There's a new API, `Folder.matching()`, which enables you to return a system folder that matches a given search path.
> View build details and download artifacts on buddybuild:
> [Files (iOS, Files-iOS)](https://dashboard.buddybuild.com/apps/5932f7d9b0c2b000015d6b79/build/5f99cd92424829000179dddd)
This release restores Files' compatibility with Mac Catalyst.
> View build details and download artifacts on buddybuild:
> [Files (iOS, Files-iOS)](https://dashboard.buddybuild.com/apps/5932f7d9b0c2b000015d6b79/build/5e13adf3fbf8f90001416e36)
- On macOS, files can now be opened within the OS by calling `open()` on them (by @Amzd).
- Fixed a bug that could cause `nameExcludingExtension` to return an empty string.
> View build details and download artifacts on buddybuild:
> [Files (iOS, Files-iOS)](https://dashboard.buddybuild.com/apps/5932f7d9b0c2b000015d6b79/build/5e0d1d8ad9c46e0001f8955a)
This release contains patches for two bugs:
- When calling the `createFileIfNeeded` set of APIs, the `content` passed as any newly created file's content was previously ignored. That has now been fixed.
- When accessing the `parent` of any folder contained within the file system's root folder, the actual root folder is now correctly returned. Thanks to @MaximeLM for implementing that fix.
> View build details and download artifacts on buddybuild:
> [Files (iOS, Files-iOS)](https://dashboard.buddybuild.com/apps/5932f7d9b0c2b000015d6b79/build/5d8e004765fdb60001b1681b)
This patch restores the `copy` API to again return the new file/folder that was copied.
> View build details and download artifacts on buddybuild:
> [Files (iOS, Files-iOS)](https://dashboard.buddybuild.com/apps/5932f7d9b0c2b000015d6b79/build/5d8a97643326cb000119c883)
Files 4.0 brings a brand new, streamlined implementation, improved error handling, more thorough documentation, and a more modern API. Since it's a new major release, some breaking API changes have been made. Here's everything that's new:
- The `FileSystem` class has been removed. To perform operations relative to the root of the file system, use the new `Folder.root` API instead. To use a custom `FileManager`, call `managedBy()` on any `File` or `Folder`.
- `FileSystem.Item` has been replaced by the `Location` protocol, and `FileSystem.Item.Kind` has been replaced by `LocationKind`.
- You can now consistently use either a `name` or `path` when using any API for creating or referring to files and subfolders within a folder.
- Methods accepting a `path` now use the simplified `at:` label, rather than `atPath:`.
- External argument labels have been removed for APIs that write new contents to a file. So `write(string:)` and `write(data:)` are now two overloads of the same method: `write(_:)`.
- All of the APIs for creating files now only accept `Data` as a file's initial contents. To write strings to a file, first create the file and then call `file.write(string)` on it.
- `File` now has a `creationDate` property.
- `Folder` now has static properties for accessing the current user's *Library* and *Documents* folders.
- Error handling has been improved to now use a unified `FilesError` type, that always contains the `path` at which the error occurred, as well as a `Reason` - which can either be for locations, writes, or reads. See the `LocationError`, `WriteError` and `ReadError` type aliases for the three types of errors that Files can throw.
- Computed properties that don't have `O(1)` time complexity have now been changed into methods instead. That includes `name()`, `count()`, and `last()` on file/folder sequences, since computing those requires enumerating the sequence. The time complexity of each sequence operation is now also documented.
- `FileSystemSequence` is now `Folder.ChildSequence`, and each sequence can now easily be turned into a recursive one by accessing the `recursive` property. The same is also true for including hidden files, which is now done by accessing the `includingHidden` property on a sequence. The `makeFileSequence(...)` and `makeSubfolderSequence(...)` APIs have been removed in favor of constructing customized sequences using those new computed properties.
> View build details and download artifacts on buddybuild:
> [Files (iOS, Files-iOS)](https://dashboard.buddybuild.com/apps/5932f7d9b0c2b000015d6b79/build/5d73a2057acd0a000130893b)
- Both `File` and `Folder` now have a `path(relativeTo:)` API, which makes it easy to calculate a given item's path relative to one of its parent folders.
- `FileSystem.documentFolder` and `FileSystem.libraryFolder` are now only available on macOS.
> View build details and download artifacts on buddybuild:
> [Files (iOS, Files-iOS)](https://dashboard.buddybuild.com/apps/5932f7d9b0c2b000015d6b79/build/5ca7cf40e6bc2600017ba26a)
Files now uses Swift `5.0`, which makes it incompatible with toolchains with versions lower than `4.2`.
> View build details and download artifacts on buddybuild:
> [Files (iOS, Files-iOS)](https://dashboard.buddybuild.com/apps/5932f7d9b0c2b000015d6b79/build/5c9a203f3f10aa0001213d1f)
- New APIs have been added to check whether a given folder contains either another folder or a file (thanks @clayellis!)
- The old, long since deprecated `creatingSubfolderFailed` error has now been fully removed.
> View build details and download artifacts on buddybuild:
> [Files (iOS, Files-iOS)](https://dashboard.buddybuild.com/apps/5932f7d9b0c2b000015d6b79/build/5c8ba3d613361600013d1fe0)
This patch makes Files backwards compatible with Swift 4.0. Thanks @iainsmith π
> View build details and download artifacts on buddybuild:
> [Files (iOS, Files-iOS)](https://dashboard.buddybuild.com/apps/5932f7d9b0c2b000015d6b79/build/5acce326090bfb00017b5d08)