- This release adds support for Swift Package Manager.
- This release replaces the custom
Result
type with the one provided by the Swift 5 Standard Library. This is a breaking change, since you now have to explicitly specify theError
type. In addition, theerror
convenience method has also been renamed tofailureResult
to match thesuccessResult
method.
- This release adds support for Swift 5.0
- Includes support to override character set for encoding URL query parameters.
- Adds
swift_version
to the podspec as it is now enforced by Cocoapods 1.6.0.
- Adds Swift 4.2 support
- Adds optional
requestTimeoutInterval
property toNetworkResourceType
which can be used to set aURLRequest
specific timeout for the resource.
- Fixes an issue where
super.start()
was being called unnecessarily.
- Adds the ability to cancel all requests from the resource service.
- Adds the ability to cancel all requests from the URLSessionType.
- Removed superfluous SwiftLint disablement.
- Handle failure to parse model in a dedicated failure case. If the response is successful, but an error is thrown during parsing, then a
NetworkServiceError.parsingModel
failure case is passed along to the completion.
- Added Codable support (
JSONDecodableResourceType
, et al)
- Migrated to Swift 4
- Moved internal
Result
to test target
- The error from a failed
NetworkResponse
is now flattened and moved into theNetworkServiceError
couldNotParseModel
case to avoid nested switch statements:
enum NetworkResponse<Model> {
case success(Model, HTTPURLResponse)
case failure(NetworkServiceError, HTTPURLResponse?)
}
-
DataResourceType
transformation function now throws on failure instead of returningResult<Model>
:// Old interface func result(from data: Data) -> Result<Model> // New interface func model(from data: Data) throws -> Model
-
JSONDictionaryResourceType
transformation function now throws on failure instead of returningModel?
:// Old interface func model(from jsonDictionary: [String : Any]) -> Model? // New interface func model(from jsonDictionary: [String : Any]) throws -> Model
-
JSONArrayResourceType
transformation function now throws on failure instead of returningModel?
:// Old interface func model(from jsonArray: [Any]) -> Model? // New interface func model(from jsonArray: [Any]) throws -> Model
-
Refactored network service
- Renamed
NetworkDataResourceService
toGenericNetworkDataResourceService
, this is useful when using it withResourceOperation
- New
NetworkDataResourceService
uses a generic fetching function NetworkDataResourceService
now usesNetworkResponse
as the result type in the completion handler
- Renamed
- Issue #21 - Added support for cancelling request
NetworkDataResourceService
now returns aCancellable
type
- Removed unnecessary
ResourceOperationType
protocol NetworkDataResourceService
now invalidates it's session on deinit
- Added support for listen to network activity changes, useful for setting up
isNetworkActivityIndicatorVisible
onUIApplication
fetch(resource: Resource, completion: @escaping (Result<Resource.Model>) -> Void)
method onNetworkDataResourceService
is nowopen
for overriding
- Added documentation on
BaseAsynchronousOperation
- Removed errors parameter from
finish()
inBaseAsynchronousOperation
URLSession
used byNetworkDataResourceService
is now exposed in the initializer
resource
,service
anddidFinishFetchingResourceCallback
properties inResourceOperation
are nowinternal
to allow for unit testing purposes
- Removed deprecated
JSONResourceType
andNetworkJSONResourceType
- Issue #9 - Improvements to meet Swift API guidelines
- Issue #3 - Query items on the
URL
for aNetworkResourceType
are now added to the generatedURLRequest
- Issue #4 - Introduced
JSONArrayResourceType
andJSONDictionaryResourceType
in favour of now deprecatedJSONResourceType
- Issue #7 -
HTTPMethod
now uses lower case enums, e.g.get
instead ofGET
- Migrated to Swift 3
- Initial release
- Retrieve JSON or image resources using a network service
- Included a resource operation to manage concurrency