Change Log

All notable changes to this project will be documented in this file.

Next

5.5.0-beta.1

Introducing support for Swift Concurrency

let request: APIRequest<Int,APIError> = tron.codable
    .request("status/200")

let result = try await request.sender().value

Swift Concurrency methods require Swift 5.5 / Xcode 13.2 / iOS 13 / tvOS 13 / macOS 10.15 / watchOS 6.

Read more usage examples in README

Added

Fixed

Breaking

5.4.1

Changed

Fixed

5.4.0

Changed

5.3.0

Added

tron.codable
    .request("status")
    .modifyRequest { $0.httpShouldHandleCookies = false }

This feature uses Alamofire.RequestModifier closure, that can also be set without DSL on request instance directly:

let request : APIRequest<Post,Empty> = tron.codable.request("posts")
request.requestModifier = { urlRequest in
    urlRequest.httpShouldHandleCookies = false
}

5.2.0

Added

Changed

Deprecated

5.1.0

Changed

5.0.3

Added

Fixed

5.0.2

5.0.1

5.0.0

5.0.0-rc.1

Added

Breaking

5.0.0-beta.5

Added

let tron = TRON(baseURL: "https://www.example.com/", buildingURL: .relativeToBaseURL)

Or you can change URLBuilder.Behavior on per-request basis, using the new DSL:

let request: APIRequest<Int,APIError> = tron.swiftyJSON
    .request("status/200")
    .buildURL(.relativeToBaseURL)

Default behavior for TRON is .appendingPathComponent.

Removed

5.0.0-beta.4

Added

func deleteSession() -> APIRequest<Empty, UnknownError> {
    let request : APIRequest<Empty, UnknownError> = tron.codable.request("session")
    request.method = .delete
    return request
}

into:

func deleteSession() -> APIRequest<Empty, UnknownError> {
    return tron.codable.request("session").delete()
}

Read more about other DSL improvements in 5.0 Migration Guide

Changed

5.0.0-beta.3

Added

Changed

pod 'TRON/SwiftyJSON'

5.0.0-beta.2

Changed

Breaking

Removed

5.0.0-beta.1

TRON now requires:

Added

Removed

Breaking

4.2.1

Fixed

4.2.0

4.1.2

4.1.1

4.1.0

4.0.0

4.0.0-beta.2

To have old behavior that allows fragmented json, use:

let request = tron.swiftyJSON(readingOptions: .allowFragments).request("path")

4.0.0-beta.1

This is major release, containing breaking API changes, please read TRON 4.0 Migration Guide

Breaking changes

// old
let request = tron.request("path")
// new
let request = tron.swiftyJSON.request("path")

3.1.1

3.1.0

3.0.3

3.0.2

3.0.1

3.0.0

Breaking changes

Bugfixes

2.0.1

Lowers deployment targets to iOS 8 / macOS 10.10

Required dependencies: Alamofire 4.1 and higher.

2.0.0

2.0.0-beta.5

2.0.0-beta.4

2.0.0-beta.3

2.0.0-beta.2

2.0.0-beta.1

TRON 2.0 is supported on iOS 9.0, macOS 10.11 and higher due to Alamofire.framework required versions. Read [migration guide](/Docs/2.0 Migration Guide.md) for overview of API changes.

NOTE This release uses forked SwiftyJSON, and SwiftyJSON3 cocoapod, because original repo has not been updated to Swift 3. In future release we hope to use SwiftyJSON cocoapod. Link

API changes

Renamings

Removals

1.1.1

Added

1.1.0

Added

By default, for backwards compatibility reasons, we use ParameterEncoding.URL as a default strategy. This will change in next major release of TRON, which will use TRON.RESTEncodingStrategy instead. This encoding strategy uses .JSON encoding for POST, PUT and PATCH requests, and .URL encoding for all other HTTP methods.

Deprecated

1.0.0

Changes

None.

If you haven't been following beta releases, please read [1.0.0 Migration Guide](/Docs/1.0 Migration Guide.md) to get an overview of new API additions and phylosophy behind some breaking changes that were made in this release.

1.0.0-beta.3

Breaking changes

Added

Changed

1.0.0-beta.2

Breaking changes

1.0.0-beta.1

TRON 1.0 is a major release with a lot of new features and breaking changes. To find out more about philosophy of those and how to adapt to new API's, read [TRON 1.0 Migration Guide](/Docs/1.0 Migration Guide.md)

Breaking changes

Added

Deprecations

0.4.3

Fixed

0.4.2

Fixed

0.4.1

Fixed

0.4.0

Breaking

Added

let request : APIRequest<EmptyResponse, MyError> = tron.request("empty/response")
let request : APIRequest<Foo, MyError> = tron.request("foo")
_ = request.rxResult.subscribeNext { result in
    print(result)
}
let multipartRequest = MultipartAPIRequest<Foo,MyError> = tron.multipartRequest("foo")

let (progress, result) = multipartRequest.rxUpload()

_ = progress.subscribeNext { progress in
    print(progress.bytesSent,progress.totalBytesWritten,progress.totalBytesExpectedToWrite)
}

_ = result.subscribeNext { result in
    print("Received result: \(result)")
}

0.3.0

Completion blocks are now handled by new EventDispatcher class, which is responsible for running completion blocks on predefined GCD-queue.

Default behaviour - all parsing is made on QOS_CLASS_USER_INITIATED queue, success and failure blocks are called on main queue.

You can specify processingQueue, successDeliveryQueue and failureDeliveryQueue on dispatcher property of TRON. After request creation you can modify queues using dispatcher property on APIRequest, or even replace EventDispatcher with a custom one.

0.2.1

Added public initializer for NetworkActivityPlugin

0.2.0

Add support for any custom mapper to be used with TRON. Defaulting to SwiftyJSON.

Examples:

Argo, ObjectMapper

Limitations

ResponseParseable and JSONDecodable are now Self-requirement protocols with all their limitations. Apart from that, there are some other limitations as well:

Subclasses

Subclassing ResponseParseable requires explicit typealias in subclassed model:

class Ancestor: JSONDecodable {
    required init(json: JSON) {

    }
}

class Sibling: Ancestor {
    typealias ModelType = Sibling
}

Discussion in mailing Swift mailing lists

Multiple custom mappers

Current architecture does not support having more than one mapper in your project, because Swift is unable to differentiate between two ResponseParseable extensions on different types.

Arrays and CollectionTypes

Currently, there's no way to extend CollectionType or Array with JSONDecodable or ResponseParseable protocol, so creating request with ModelType of array(APIRequest<[Foo],Bar>) is not possible.

Blocking radars: https://www.openradar.me/23433955 https://www.openradar.me/23196859

0.1.0

Initial OSS release, yaaaay!