Skip to content

Commit

Permalink
Added defaults to Timeline and Response initializers to maintain back…
Browse files Browse the repository at this point in the history
…wards compatibility.
  • Loading branch information
cnoon committed Feb 8, 2016
1 parent 8eb5123 commit 07f2f0a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Source/Response.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public struct Response<Value, Error: ErrorType> {
- parameter response: The server's response to the URL request.
- parameter data: The data returned by the server.
- parameter result: The result of response serialization.
- parameter timeline: The timeline of the complete lifecycle of the `Request`.
- parameter timeline: The timeline of the complete lifecycle of the `Request`. Defaults to `Timeline()`.

- returns: the new `Response` instance.
*/
Expand All @@ -56,7 +56,7 @@ public struct Response<Value, Error: ErrorType> {
response: NSHTTPURLResponse?,
data: NSData?,
result: Result<Value, Error>,
timeline: Timeline)
timeline: Timeline = Timeline())
{
self.request = request
self.response = response
Expand Down
18 changes: 10 additions & 8 deletions Source/Timeline.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,20 @@ public struct Timeline {
/**
Creates a new `Timeline` instance with the specified request times.

- parameter requestStartTime: The time the request was initialized.
- parameter initialResponseTime: The time the first bytes were received from or sent to the server.
- parameter requestCompletedTime: The time when the request was completed.
- parameter serializationCompletedTime: The time when the response serialization was completed.
- parameter requestStartTime: The time the request was initialized. Defaults to `0.0`.
- parameter initialResponseTime: The time the first bytes were received from or sent to the server.
Defaults to `0.0`.
- parameter requestCompletedTime: The time when the request was completed. Defaults to `0.0`.
- parameter serializationCompletedTime: The time when the response serialization was completed. Defaults
to `0.0`.

- returns: The new `Timeline` instance.
*/
public init(
requestStartTime: CFAbsoluteTime,
initialResponseTime: CFAbsoluteTime,
requestCompletedTime: CFAbsoluteTime,
serializationCompletedTime: CFAbsoluteTime)
requestStartTime: CFAbsoluteTime = 0.0,
initialResponseTime: CFAbsoluteTime = 0.0,
requestCompletedTime: CFAbsoluteTime = 0.0,
serializationCompletedTime: CFAbsoluteTime = 0.0)
{
self.requestStartTime = requestStartTime
self.initialResponseTime = initialResponseTime
Expand Down

0 comments on commit 07f2f0a

Please sign in to comment.