Product updates · 3 min read

iOS API client

New Swift API client for iOS, macOS and tvOS

New Swift API client to simplify your iOS, macOS and tvOS usage. Swift API client streamlines the coding process. Chunking files is handled for you, as is pagination and refreshing your tokens.

Thibault Beyou

February 2, 2022

api.video removes the complexity from streaming video. Our simple to use APIs allow you to focus on creating your content -- leave the video streaming details to us.

Few months ago, we announced our Android API client, we are now happy to announce the release of our Swift API client for iOS, macOS and tvOS. We are replacing the iOS SDK to simplify api.video usages and deployment of the new version. It also provides support for api.video progressive upload. We will focus on the progressive upload part in another blog articles.

The Swift API client comes with:

This article is a walkthrough to upload a file with Swift API client.

Installation

Cocoapods

  1. Add the following entry to your Podfile:

ruby

  1. Then run pod install

  2. Import ApiVideoClient in every file you’d like to use Swift API client.

Carthage

  1. Add the following entry to your Cartfile:

bash

  1. Then run carthage update

  2. Import ApiVideoClient in every file you’d like to use Swift API client.

Swift API configuration

To use the Swift API client, you first have to import the ApiVideoClient.

swift

ApiVideoClient class provides static fields and methods to configure the Swift API client. You can set your API key, your environment (sandbox or production), chunk size,...

Set your API key with:

swift

If you want to target the sandbox environment:

swift

Create a video file

If you haven't create a video on api.video, you have to create a video entry on api.video platform with:

swift

Description of the fields of VideoCreationPayload is provided here.

Upload a video file

To upload a file, you will have to get the URL of your file. You can get it from the image picker component. Have a look at our a sample code.

swift

If you want to draw a progress bar that displays the upload progress, there is a onProgressReady: ((Progress) -> Void) parameter to the upload method.

Swift API client capabilities

The Swift API client provides methods to perform every possible actions on the api.video API such as list videos (with filters), delete video, add/remove captions,... If you are not familiar with api.video API, you should have a look on api.video documentation documentation. You will find the same concepts in the Swift API client documentation.

Swift video uploader

If you want to develop an application that only uploads video files. You should have a look at the Swift video uploader.

Don't hesitate to share your feedback on our community. Happy building!

Try out more than 80 features for free

Access all the features for as long as you need.
No commitment or credit card required

Video API, simplified

Fully customizable API to manage everything video. From encoding to delivery, in minutes.

Built for Speed

The fastest video encoding platform. Serve your users globally with 140+ points of presence. 

Let end-users upload videos

Finally, an API that allows your end-users to upload videos and start live streams in a few clicks.

Affordable

Volume discounts and usage-based pricing to ensure you don’t exceed your budget.