Releases: MLSDev/TRON
Releases · MLSDev/TRON
5.0.0-rc.1
Added
- Better debug prints for
NetworkLoggerPluginwhen decoding usingCodableprotocol. configure(_:)method forBaseRequestDSL to allow configuring request with several changes at once.
Breaking
- Plugin API that previously was called with
Alamofire.Data/DownloadResponse<Model, Error>is now called withAlamofire.Data/DownloadResponse<Model, AFError>due to Alamofire changes to error handling. performCollectingTimeline(withCompletion:)method is now called also withAFErrorinstead ofError.
5.0.0-beta.5
Added
- Support for per-request Interceptors.
- Three different behaviors for building URLs:
.appendingPathComponent,.relativeToBaseURLand.custom. Those can be set in TRON initializer:
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
URLBuildableprotocol. Please use different behaviors forURLBuilderinstead.
5.0.0-beta.4
Added
- Support for Swift Package Manager in Xcode 11
- New convenient DSL, that allows to convert this code:
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
URLBuildernow resolves URL's usingURL(string:relativeTo:)method, thus allowing more flexible url creation.
5.0.0-beta.3
Added
- Ability to traverse json to any level when using SwiftyJSONDecodable.
Changed
- Improved response serializer behavior for cases where requests were stubbed using URLProtocol.
- TRON 5 requires RxSwift 5 and SwiftyJSON 5
Coreis now a default subspec for CocoaPods installation method. To use SwiftyJSON, add following to Podfile:
pod 'TRON/SwiftyJSON'4.2.2
- Swift 4.2 version is now specified in podspec for users of CocoaPods 1.6.x.
This is the last release that supports Xcode 9 and Swift 3.
5.0.0-beta.2
Changed
ErrorSerializableprotocol changed to have non-optional initializer and to not acceptserializedObject. It no longer can be used for additional object validation, but behavior should be more predictable and straightforward -ErrorSerializableshould only be created if somebody (URL loading system, Alamofire or Model serialization) actually reported error.codableis now a lazy stored property instead of computed property.CodableSerializerAPI has been made open to allow easy customization in subclasses.NetworkLoggerPluginnow has a constructor that allows to easily configure it's behavior.
Breaking
- Properties that worked with
Alamofire.SessionManagerhave been renamed tosessionto be in line withAlamofirerenaming ofSessionManagertoSession.
Removed
TRON.defaultAlamofireManager()method. TRON initializer now usesAlamofire.Session.defaultas a replacement.TRON.processingQueueproperty
5.0.0-beta.1
TRON now requires:
- Xcode 10
- Swift 4 and higher
- iOS/tvOS 10 and higher
- watchOS 3 and higher
- macOS 10.12 and higher
Added
- Complete documentation
TRONDataResponseSerializerandTRONDownloadResponseSerializerstructs to encapsulate serialization of responses using closure.- All test suite now uses
StubbingURLProtocolto stop tests from sending network requests. Closes #21. - Additional
JSONDecodableconformances have been added for arithmetic types such asInt8...Int64,UInt8...64.
Removed
EmptyResponsetype was replaced withAlamofire.Emptystruct to not interfere withAlamofire.EmptyResponseprotocol.TRON.stubbingShouldBeSuccessfulproperty since now each stub directly defines it's behavior instead of global setting- Conditional conformance of
ArraytoJSONDecodable - Convenience download methods on
CodableSerializerandJSONDecodableSerializer AuthorizationRequirementenum. Please useAlamofire.RequestAdapterandSession.adapterproperty to adapt request, when additional headers are needed.HeaderBuildableprotocol andHeaderBuildertypes. Please useBaseRequest.headersproperty of typeAlamofire.HTTPHeadersdirectly.ErrorHandlingDataResponseSerializerProtocolandErrorHandlingDownloadResponseSerializerprotocol. Now,ErrorModelon all requests conforms toErrorSerializableprotocol, that contains initializer that allows to create it directly.CodableDownloadParserandJSONDecodableDownloadParser, replacement classDownloadSerializerhas been introduced, it allows to create a data model by implementingDownloadResponseSerializerProtocol
Breaking
headersproperty ofBaseRequestnow containsHTTPHeaderstype instead of[String: String]. Please note that along withHeaderBuilderremoval TRON no longer sends 'Accept':'application/json' header by default.APIErroris changed to be able to acceptSerializedObjectand is now a class with nullable initializer. Also,DownloadAPIErrortype has been introduced for download errors, that do not haveDatain them, but havefileURLinstead.Pluginmethods that previously acceptedAPIError<ErrorModel>now acceptErrorModeldirectly. AddeddidSuccessfullyParseDownloadResponseanddidReceiveDownloadResponsemethods.- All concrete implementations of
DataResponseSerializerProtocolsuch asCodableParserandJSONDecodableParsernow have only one generic argument -Modeland are only parsing model type. JSONDecodableParserandCodableParsernow have only one generic argument -Model, sinceErrorModelis now moved toErrorSerializableprotocol, that does not depend on any particular serializer.APIStubhas been rewritten from scratch to allow injecting only results of network request(URLRequest,HTTPURLResponse,Data,ErrorandfileURL) as opposed to actualModelanderrorModelas well as definition of successful/unsuccessful requests.APIStubnow is been attached toAlamofire.Requestwhen stubbing for this particular request has been enabled. Rewrite also allows plugin callbacks to be called more consistently for both stubbed and unstubbed cases.rxMultipartResultmethod onUploadRequestmethod was removed sinceUploadRequestfor multipart requests in Alamofire 5 is now synchronous and now does not require special handling. You can now callrxResultreplacement method instead.
4.2.0
- Implemented
JSONDecodablesupport for Arrays, whose Element is JSONDecodable. Requires Swift 4.1 to work.
4.1.2
- Improved output of
NetworkLoggerPlugin, which now includes status codes, HTTP body contents, and some emojis 🚀
4.1.1
- Allow
EmptyResponseto be used with CodableParser when network response does not contain valid JSON.