Welcome to the TUSKit documentation! TUSKit is a lightweight iOS SDK that provides an easy-to-use implementation of the TUS protocol, allowing you to easily upload and download files to and from a TUS server.


How to Install with CocoaPods

  1. Open your project in Xcode.
  2. If you haven’t set up CocoaPods yet, open Terminal and navigate to your project directory. Run the command:
    $ pod init
  1. Edit the Podfile and add the following line:
    pod 'TUSKit'
  1. Save the Podfile and run the command:
    $ pod install

How to Install Manually

  1. Download the latest TUSKit framework from GitHub.
  2. Drag and drop the TUSKit framework into your Xcode project.
  3. In your project settings, navigate to the General tab and scroll down to the Frameworks, Libraries, and Embedded Content section.
  4. Click on the + button and select the TUSKit framework.
  5. Make sure the framework is added under Frameworks, Libraries, and Embedded Content and not Linked Frameworks and Libraries.


Importing TUSKit

In your Swift file, import the TUSKit module:

    import TUSKit

Creating a TUSManager

To use TUSKit, create an instance of the TUSManager class:

    let tusManager = TUSManager.shared

Uploading a File

To upload a file to the TUS server, use the uploadFile(_:) method:

    tusManager.uploadFile(fileURL) { progress, error in
      // Handle progress and error

Downloading a File

To download a file from the TUS server, use the downloadFile(_:) method:

    tusManager.downloadFile(fileURL) { progress, error in
      // Handle progress and error

Advanced Options

Setting Custom Headers

You can set custom headers to be sent along with the TUS requests. Use the setRequestHeader(_:forKey:) method to add custom headers:

    tusManager.setRequestHeader("Bearer token", forKey: "Authorization")

Setting Chunk Size for Upload

If you want to customize the chunk size for uploads, use the setUploadChunkSize(_:) method:

    tusManager.setUploadChunkSize(1024 * 1024) // 1MB

Override Default TUS Endpoint URL

If you have a custom TUS server endpoint, you can override the default endpoint URL using the overrideDefaultTUSUploadURL(_:) method:



Congratulations! You now have a basic understanding of how to use TUSKit to upload and download files using the TUS protocol. For more detailed information and additional features, refer to the TUSKit documentation on GitHub.