Skip to content

Commit 4bd5302

Browse files
Merge pull request #52 from dbsystel/release/0.6.0
Release 0.6.0 💈
2 parents 0d18f5b + eff8566 commit 4bd5302

File tree

1 file changed

+2
-28
lines changed

1 file changed

+2
-28
lines changed

README.md

+2-28
Original file line numberDiff line numberDiff line change
@@ -74,38 +74,13 @@ networkService.request(resource, onCompletion: { origin in
7474
})
7575
```
7676

77-
## Extendability
78-
The following example outlines how to extend DBNetworkStack to support XML response models:
79-
80-
```swift
81-
protocol XMLMappable {
82-
init(object: Dictionary<String, AnyObject>) throws
83-
}
84-
85-
struct XMLResource<T : XMLMappable> : ResourceModeling {
86-
let request: NetworkRequestRepresening
87-
88-
init(request: NetworkRequestRepresening) {
89-
self.request = request
90-
}
91-
92-
var parse: (data: NSData) throws -> T {
93-
return { data in
94-
let xmlObject = // Your data to xml object conversion
95-
try! T(object: xmlObject) as T
96-
}
97-
}
98-
}
99-
```
100-
```XMLMappable``` defines the protocol, response model objects must conform to. The model class conforming to this protocol is responsible to convert a generic representation of the model into it’s specialized form.
101-
```XMLResource<T : XMLMappable>``` defines a resource based on a given ```XMLMappable``` model. The parse function is responsible of converting raw response data to a generic representation.
102-
10377
## Accessing HTTPResponse
10478

10579
Request your resource and handle the result & response. This is similar to just requesting a resulting model.
10680
```swift
10781
networkService.request(resource, onCompletionWithResponse: { htmlText, response in
10882
print(htmlText)
83+
print(response)
10984
}, onError: { error in
11085
//Handle errors
11186
})
@@ -122,7 +97,6 @@ The following table shows all the protocols and their default implementations.
12297
| ```NetworkServiceProviding``` | ```NetworkService``` |
12398
| ```NetworkRequestRepresenting``` | ```NetworkRequest``` |
12499
| ```NetworkTaskRepresenting``` | ```URLSessionTask``` |
125-
| ```ResourceModelling``` | ```Resource<Model>``` |
126100

127101
## Composable Features
128102

@@ -146,7 +120,7 @@ The following table shows all the protocols and their default implementations.
146120
Specify the following in your `Cartfile`:
147121

148122
```ogdl
149-
github "dbsystel/dbnetworkstack" ~> 0.5
123+
github "dbsystel/dbnetworkstack" ~> 0.6
150124
```
151125

152126
### CocoaPods

0 commit comments

Comments
 (0)