Skip to content

Migration guide to version 3.x

Clément Le Provost edited this page Apr 11, 2016 · 4 revisions

Overview

Version 3 brought a few incompatible changes to the Swift client's public interface. This guide will help you adapt your code to work with the new version.

This guide only focuses on incompatible changes. For a complete list of all changes, please refer to ChangeLog.md at the root of the repository.

NOTE: If you are coming from Objective-C, you should read the Objective-C to Swift migration guide first. Although it was created for version 2, everything still applies to version 3.

Changes

  • The completion block argument of asynchronous methods has been renamed to completionHandler. If you don't use the trailing closure syntactic sugar, you will have to rename the parameter label everywhere.

  • Some query parameters have been renamed to match the name from the REST API.

  • The type of some query parameters has changed for better type safety.

  • Accessors to obsolete security HTTP headers have been removed (Client.queryParameters, Client.tagFilters, Client.userToken). If you need them:

    1. First please consider migrating to secured API keys, which are now the preferred way to deal with per-user authorization.
    2. If you really need the legacy headers, you may set them via Client.headers.
  • The browse iterator has been moved to a dedicated helper (BrowseIterator). The methods in the Index class are now low-level only.

  • Operations requiring an admin API key have been removed. For obvious security reasons, the admin key should never be used on the client side. There is no plan to reintegrate those features.

Clone this wiki locally