Swift integration handles uploads and file operations by wrapping Uploadcare Upload API and REST API. This comprehensive API client lets you use most of the Uploadcare features from within your Android app. It also includes a native uploading widget. Builds are available for iOS, iPadOS, tvOS, Linux and macOS.
Check out a swift demo app that we created as a showcase for various usage scenarios and tasks that you can resolve.
Uploading (Upload API):
File uploading widget:
File management (REST API):
Image processing (URL API):
Security features:
To use a stable version, add a dependency to your Package.swift file:
If you want to try the current dev version, change the dependency to:
To add from Xcode select File -> Swift Packages -> Add Package Dependency and enter the repository URL:
https://github.com/uploadcare/uploadcare-swift
Or you can add it in Xcode to the packages list using that URL: https://github.com/uploadcare/uploadcare-swift
(select master branch).
To use a stable version, add a dependency to your Cartfile:
To use the current dev version:
To use a stable version, add a dependency to your Podfile:
To use current dev version:
Create your project in Uploadcare Dashboard and copy its API keys from there.
Upload API requires only a public key, while REST API requires both public and secret keys:
You can create more Uploadcare objects if you need to work with multiple projects in your Uploadcare account:
Keep in mind that since Uploadcare is not a singleton. You should store a strong reference (as an instance variable, for example) to your Uploadcare object or it will get deallocated.
Check the Upload API documentation to see all available methods.
Each method has an implementation with a Result completion handler and has
an alternative async implementation to use with Swift concurrency.
Example of uploads:
It is possible to perform uploads in the background. But implementation is platform-specific. This lib doesn’t provide a default implementation. You can find an example for the iOS in our Demo app. See FilesListStore.swift.
Refer to the REST API documentation for all methods.
Each method has an implementation with a Result completion handler
and has an alternative async implementation to use with Swift concurrency.
Example of getting list of files:
Get next page:
Get previous page:
Read the full documentation on GitHub.
Check the demo app for usage examples: