Skip to content

Latest commit

 

History

History
70 lines (48 loc) · 2.69 KB

APIKit3MigrationGuide.md

File metadata and controls

70 lines (48 loc) · 2.69 KB

APIKit 3 Migration Guide

APIs of APIKit are redesigned to follow Swift 3 API design guidelines. This major version changes interface only, and all functionalities are same as APIKit 2.

NOTE: Make sure that all old protocol methods are replaced by the new method. Especially, methods which has default implementation such as interceptURLRequest(_:) and interceptObject(_:URLResponse:), because Swift compiler cannot warn that existing method is no longer a member of any protocol. To find this kind of old methods, search project with keyword interceptURLRequest and interceptObject.

Name of protocols

  • [Renamed] RequestTypeRequest
  • [Renamed] SessionAdapterTypeSessionAdapter
  • [Renamed] SessionTaskTypeSessionTask
  • [Renamed] BodyParametersTypeBodyParameters
  • [Renamed] DataParserTypeDataParser

Request

  • [Renamed] interceptURLRequest(_:)intercept(urlRequest:)
  • [Renamed] interceptObject(_:URLResponse:)intercept(object:urlResponse:)
  • [Renamed] responseFromObject(_:URLResponse:)response(from:urlResponse:)

Session

  • [Renamed] sharedSessionshared
  • [Renamed] sendRequest(_:callbackQueue:handler:)send(_:callbackQueue:handler:)
  • [Renamed] cancelRequest(_:passingTest:)cancelRequests(with:passingTest:)

HTTPMethod

  • [Renamed] GETget
  • [Renamed] POSTpost
  • [Renamed] PUTput
  • [Renamed] HEADhead
  • [Renamed] DELETEdelete
  • [Renamed] PATCHpatch
  • [Renamed] TRACEtrace
  • [Renamed] OPTIONSoptions
  • [Renamed] CONNECTconnect

CallbackQueue

  • [Renamed] Mainmain
  • [Renamed] SessionQueuesessionQueue
  • [Renamed] OperationQueueoperationQueue
  • [Renamed] DispatchQueuedispatchQueue

SessionAdapter

  • [Renamed] createTaskWithURLRequest(_:handler:)createTask(with:handler:)
  • [Renamed] getTasksWithHandler(_:)getTasks(with:)

DataParser

  • [Renamed] parseData(_:)parse(data:)

SessionTaskError

  • [Renamed] ConnectionErrorconnectionError
  • [Renamed] RequestErrorrequestError
  • [Renamed] ResponseErrorresponseError

RequestError

  • [Renamed] InvalidBaseURLinvalidBaseURL
  • [Renamed] UnexpectedURLRequestunexpectedURLRequest

ResponseError

  • [Renamed] NonHTTPURLResponsenonHTTPURLResponse
  • [Renamed] UnacceptableStatusCodeunacceptableStatusCode
  • [Renamed] UnexpectedObjectunexpectedObject