Skip to content

Commit 60f4adf

Browse files
committed
Documentation fixes
1 parent 0d301e9 commit 60f4adf

11 files changed

+35
-29
lines changed

Source/BasicNetworkService.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,9 @@ public final class BasicNetworkService: NetworkService {
4040
let networkResponseProcessor: NetworkResponseProcessor
4141

4242
/**
43-
Creates an `BasicNetworkService` instance with a given networkAccess and a map of endPoints
43+
Creates an `BasicNetworkService` instance with a given network access to execute requests on.
4444

4545
- parameter networkAccess: provides basic access to the network.
46-
- parameter endPoints: map of baseURLKey -> baseURLs
4746
*/
4847
public init(networkAccess: NetworkAccess) {
4948
self.networkAccess = networkAccess
@@ -54,7 +53,7 @@ public final class BasicNetworkService: NetworkService {
5453
Fetches a resource asynchronously from remote location. Execution of the requests starts immediately.
5554
Execution happens on no specific queue. It dependes on the network access which queue is used.
5655
Once execution is finished either the completion block or the error block gets called.
57-
You can decide on which queue these blocks get called.
56+
You decide on which queue these blocks get executed.
5857

5958
**Example**:
6059
```swift
@@ -68,7 +67,7 @@ public final class BasicNetworkService: NetworkService {
6867
})
6968
```
7069

71-
- parameter queue: The DispatchQueue to execute the completion and error block on.
70+
- parameter queue: The `DispatchQueue` to execute the completion and error block on.
7271
- parameter resource: The resource you want to fetch.
7372
- parameter onCompletionWithResponse: Callback which gets called when fetching and transforming into model succeeds.
7473
- parameter onError: Callback which gets called when fetching or transforming fails.

Source/ModifyRequestNetworkService.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import Foundation
2525
import Dispatch
2626

2727
/**
28-
`ModifyRequestNetworkService` can be composed with a networkService to modify all outgoing requests.
28+
`ModifyRequestNetworkService` can be composed with a network service to modify all outgoing requests.
2929
One could add auth tokens or API keys for specifics URLs.
3030

3131
**Example**:
@@ -58,7 +58,7 @@ public final class ModifyRequestNetworkService: NetworkService {
5858
Fetches a resource asynchronously from remote location. Execution of the requests starts immediately.
5959
Execution happens on no specific queue. It dependes on the network access which queue is used.
6060
Once execution is finished either the completion block or the error block gets called.
61-
You can decide on which queue these blocks get called.
61+
You decide on which queue these blocks get executed.
6262

6363
**Example**:
6464
```swift
@@ -72,7 +72,7 @@ public final class ModifyRequestNetworkService: NetworkService {
7272
})
7373
```
7474

75-
- parameter queue: The DispatchQueue to execute the completion and error block on.
75+
- parameter queue: The `DispatchQueue` to execute the completion and error block on.
7676
- parameter resource: The resource you want to fetch.
7777
- parameter onCompletionWithResponse: Callback which gets called when fetching and transforming into model succeeds.
7878
- parameter onError: Callback which gets called when fetching or transforming fails.

Source/NetworkResponseProcessor.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ final class NetworkResponseProcessor {
6262
/// The result will be return via a blocks onCompletion/onError.
6363
///
6464
/// - Parameters:
65-
/// - queue: The DispatchQueue to execute the completion and error block on.
65+
/// - queue: The `DispatchQueue` to execute the completion and error block on.
6666
/// - response: the HTTPURLResponse one wants to parse.
6767
/// - resource: the resource.
6868
/// - data: the payload of the response.

Source/NetworkService.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public protocol NetworkService {
3535
Fetches a resource asynchronously from remote location. Execution of the requests starts immediately.
3636
Execution happens on no specific queue. It dependes on the network access which queue is used.
3737
Once execution is finished either the completion block or the error block gets called.
38-
You can decide on which queue these blocks get called.
38+
You decide on which queue these blocks get executed.
3939

4040
**Example**:
4141
```swift
@@ -49,7 +49,7 @@ public protocol NetworkService {
4949
})
5050
```
5151

52-
- parameter queue: The DispatchQueue to execute the completion and error block on.
52+
- parameter queue: The `DispatchQueue` to execute the completion and error block on.
5353
- parameter resource: The resource you want to fetch.
5454
- parameter onCompletionWithResponse: Callback which gets called when fetching and transforming into model succeeds.
5555
- parameter onError: Callback which gets called when fetching or transforming fails.

Source/NetworkServiceMock.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public final class NetworkServiceMock: NetworkService {
8585
Fetches a resource asynchronously from remote location. Execution of the requests starts immediately.
8686
Execution happens on no specific queue. It dependes on the network access which queue is used.
8787
Once execution is finished either the completion block or the error block gets called.
88-
You can decide on which queue these blocks get called.
88+
You decide on which queue these blocks get executed.
8989

9090
**Example**:
9191
```swift
@@ -99,7 +99,7 @@ public final class NetworkServiceMock: NetworkService {
9999
})
100100
```
101101

102-
- parameter queue: The DispatchQueue to execute the completion and error block on.
102+
- parameter queue: The `DispatchQueue` to execute the completion and error block on.
103103
- parameter resource: The resource you want to fetch.
104104
- parameter onCompletionWithResponse: Callback which gets called when fetching and transforming into model succeeds.
105105
- parameter onError: Callback which gets called when fetching or transforming fails.

Source/Resource+Inspect.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ extension Resource {
2626

2727
```swift
2828
let resource: Resource<Train> = //
29-
resource.inspectData({ data in
29+
resource.inspectData { data in
3030
print(String(bytes: data, encoding: .utf8))
3131
}
3232
```

Source/Resource.swift

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,20 @@
2424
/**
2525
`Resource` describes a remote resource of generic type.
2626
The type can be fetched via HTTP(S) and parsed into the coresponding model object.
27+
28+
**Example**:
29+
```swift
30+
let request: URLRequest = //
31+
let resource: Resource<String> = Resource(request: request, parse: { data in
32+
String(data: data, encoding: .utf8)
33+
})
34+
```
2735
*/
2836
public struct Resource<Model> {
2937
/// The request to fetch the resource remote payload
3038
public let request: URLRequestConvertible
31-
/**
32-
Parses data into given Model
33-
*/
39+
40+
/// Parses data into given model.
3441
public let parse: (_ data: Data) throws -> Model
3542

3643
/// Creates a type safe resource, which can be used to fetch it with `NetworkService`

Source/RetryNetworkService.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public final class RetryNetworkService: NetworkService {
6161
Fetches a resource asynchronously from remote location. Execution of the requests starts immediately.
6262
Execution happens on no specific queue. It dependes on the network access which queue is used.
6363
Once execution is finished either the completion block or the error block gets called.
64-
You can decide on which queue these blocks get called.
64+
You decide on which queue these blocks get executed.
6565

6666
**Example**:
6767
```swift
@@ -75,7 +75,7 @@ public final class RetryNetworkService: NetworkService {
7575
})
7676
```
7777

78-
- parameter queue: The DispatchQueue to execute the completion and error block on.
78+
- parameter queue: The `DispatchQueue` to execute the completion and error block on.
7979
- parameter resource: The resource you want to fetch.
8080
- parameter onCompletionWithResponse: Callback which gets called when fetching and transforming into model succeeds.
8181
- parameter onError: Callback which gets called when fetching or transforming fails.

Source/URLRequestConvertible+Modifications.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public extension URLRequestConvertible {
4141
/// Creates a new `URLRequestConvertible` with query items appended to the new request.
4242
///
4343
/// - Parameter queryItems: the query items to append to the request
44-
/// - Parameter overrideExisting: if true existing items with the same name will be overridden
44+
/// - Parameter overrideExisting: if `true existing items with the same name will be overridden
4545
/// - Returns: a new `URLRequestConvertible`
4646
func appending(queryItems: [URLQueryItem], overrideExisting: Bool = true) -> URLRequestConvertible {
4747
var request = asURLRequest()
@@ -55,15 +55,15 @@ public extension URLRequestConvertible {
5555
/// Creates a new `URLRequestConvertible` with query parameters appended to the new request.
5656
///
5757
/// - Parameter queryParameters: the parameters to append to the request
58-
/// - Parameter overrideExisting: if true existing items with the same name will be overridden
58+
/// - Parameter overrideExisting: if `true existing items with the same name will be overridden
5959
/// - Returns: a new `URLRequestConvertible`
6060
func appending(queryParameters: [String: String], overrideExisting: Bool = true) -> URLRequestConvertible {
6161
return appending(queryItems: queryParameters.asURLQueryItems() )
6262
}
6363

6464
/// Creates a new `URLRequestConvertible` with all existing query items replaced with new ones.
6565
///
66-
/// - Parameter queryItems: the queryItems to add to the request
66+
/// - Parameter queryItems: the query items to add to the request
6767
/// - Returns: a new `URLRequestConvertible`
6868
func replacingAllQueryItems(with queryItems: [URLQueryItem]) -> URLRequestConvertible {
6969
var request = asURLRequest()

Source/URLRequestConvertible.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ extension URLRequest {
4545
/// Convience initializer for easy request creation.
4646
///
4747
/// - Parameters:
48-
/// - path: path to the resource
49-
/// - baseURL: the base url of the resource
50-
/// - HTTPMethod: the HTTP method for the request
51-
/// - parameters: url parameters for the request
52-
/// - body: body data payload
53-
/// - allHTTPHeaderFields: HTTP request header fields
48+
/// - path: path to the resource.
49+
/// - baseURL: the base url of the resource.
50+
/// - HTTPMethod: the HTTP method for the request. Defaults to `.GET`
51+
/// - parameters: url parameters for the request. Defaults to `nil`
52+
/// - body: body data payload. Defaults to `nil`
53+
/// - allHTTPHeaderFields: HTTP request header fields. Defaults to `nil`
5454
///
5555
/// - Important: path must not start with a `/`
5656
public init(path: String, baseURL: URL,

0 commit comments

Comments
 (0)