Skip to content

Commit

Permalink
Updated function definitions to include optional key path with defaul…
Browse files Browse the repository at this point in the history
…t value of nil
  • Loading branch information
tristanhimmelman committed Nov 24, 2015
1 parent c96a202 commit f17758d
Showing 1 changed file with 2 additions and 24 deletions.
26 changes: 2 additions & 24 deletions AlamofireObjectMapper/AlamofireObjectMapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,6 @@ extension Request {
}
}

/**
Adds a handler to be called once the request has finished.

- parameter completionHandler: A closure to be executed once the request has finished and the data has been mapped by ObjectMapper.

- returns: The request.
*/
public func responseObject<T: Mappable>(completionHandler: Response<T, NSError> -> Void) -> Self {
return responseObject(nil, keyPath: nil, completionHandler: completionHandler)
}

/**
Adds a handler to be called once the request has finished.

Expand All @@ -83,7 +72,7 @@ extension Request {

- returns: The request.
*/
public func responseObject<T: Mappable>(keyPath: String, completionHandler: Response<T, NSError> -> Void) -> Self {
public func responseObject<T: Mappable>(keyPath: String? = nil, completionHandler: Response<T, NSError> -> Void) -> Self {
return responseObject(nil, keyPath: keyPath, completionHandler: completionHandler)
}

Expand Down Expand Up @@ -143,17 +132,6 @@ extension Request {
return .Failure(error)
}
}

/**
Adds a handler to be called once the request has finished.

- parameter completionHandler: A closure to be executed once the request has finished and the data has been mapped by ObjectMapper.

- returns: The request.
*/
public func responseArray<T: Mappable>(completionHandler: Response<[T], NSError> -> Void) -> Self {
return responseArray(nil, keyPath: nil, completionHandler: completionHandler)
}

/**
Adds a handler to be called once the request has finished.
Expand All @@ -163,7 +141,7 @@ extension Request {

- returns: The request.
*/
public func responseArray<T: Mappable>(keyPath: String, completionHandler: Response<[T], NSError> -> Void) -> Self {
public func responseArray<T: Mappable>(keyPath: String? = nil, completionHandler: Response<[T], NSError> -> Void) -> Self {
return responseArray(nil, keyPath: keyPath, completionHandler: completionHandler)
}

Expand Down

1 comment on commit f17758d

@thedavejay
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please update the documentation as the responseArray doesnt work anymore according to what it says

Please sign in to comment.