WebDAV Swift is a Swift library for communicating with WebDAV servers such as Nextcloud.
- Create, read, update, and delete files
- Image and thumbnail fetching from Nextcloud servers
- Multi-level memory and disk cache for images and thumbnails
- Automatic cache cleaning
- Multiple account support
- Swift Package Manager support
WebDAV servers such as Nextcloud are great ways of hosting your own personal cloud storage. I’ve been using Nextcloud for years and have had several ideas for apps I’d like to make integrating with it. I originally tried using the library amosavian/FileProvider but had several issues with it. The first of which was a lack of support for getting thumbnails from Nextcloud. I figured out how to generate thumbnails using the Nextcloud API, and since FileProvider was open-source, I added that feature as a contribution to the library. I still wasn’t quite satisfied for various other reasons, however, and decided to make my own library.
Another issue I had with previous WebDAV libraries is the lack of support for using multiple accounts. The library I created uses ephemeral URL Sessions to allow for use of multiple accounts without needed to worry about credential caching or profile switching.
Version 3.0 replaces the old caching system using a third-party networking library with an in-house caching system build specifically for WebDAV usage. It caches files and images in both memory and on disk, and automatically clears cached data when it detects that it has been deleted from the server.
The library includes thorough unit tests to ensure performance as intended. I have also been testing the library in a real-word environment in apps that are currently in development.