Releases: bustoutsolutions/siesta
Swift 2 rides into the sunset
This release includes the last planned API changes for Swift 2.x. Barring the discovery of serious API design flaws, Swift 2 work from now on will be bug fixes only.
A preview of Swift 3 compatibility is now available on the swift3
branch. Grab that beta and hop on the ride! A wild oscillation between delight and apoplexy awaits. See the release plans for goals & timeline, and subscribe to #103 for status updates.
Enhancements
- Request decorators, chains, and repeats: it is now possible to configure serivce-wide request behaviors such as automatic token renewal. See the new examples in the user guide. (#98, #104)
- Improved content transformer type mismatch behavior. (#100)
- UI helpers are in a separate module; directories are reorganized in anticipation of SwiftPM support. (#102)
Entity.headers
is now public. (#107)
Fixes
- Updated and expanded user guide. The new host whitelisting section is of particular note.
- Fixed minor API doc breakage. (#92)
Breaking Changes
- The UI helpers,
ResourceStatusOverlay
andRemoteImageView
, are now separate from the Siesta core API:- If you are using Carthage or building the framework directly from the Xcode project, they are now in a separate
SiestaUI
framework. You will need to include that framework separately in your project, and addimport SiestaUI
in your code. - If you are using Cocoapods, the UI helpers are in a separate subspec. You will need to add
pod 'Siesta/UI'
to yourPodfile
. However, due to limitations of Cocoapods, you will stillimport Siesta
for UI helpers and core API alike.
- If you are using Carthage or building the framework directly from the Xcode project, they are now in a separate
Request.onCompletion
now takes aResponeInfo
struct instead of just aResponse
. Where your existingonCompletion
hook uses$0
, replace it with$0.response
.- The
skipWhenEntityMatchesOutputType:
option is gone, without an exact replacement. See #100.
Keys Please
Enhancements
- Big changes to
EntityCache
, which should open the door to much more creative and interesting persistent local mirroring of API data. Thanks to @jordanpwood for helping think through this tricky work. (Extensive writeup in #95; see also #89, #90)- Caches are now responsible for generating their own keys, which are opaque to Siesta and can be of an arbitrary type.
- Caches can now specify the GCD queue on which they work (including the main queue).
- Experimental ReactiveCocoa integration now in
Extensions/ReactiveCocoa
. Kick the tires and send feedback. Thanks to @akaralar for coding this and seeing it through! (#71) Service
methods withbaseURL
andabsoluteURL
parameters all now accept bothString
andNSURL
. Good idea, @jordanpwood. (#74, #77)- Added
Service.resource(baseURL:path:)
to better support APIs without a clear singlebaseURL
. Thanks to @Reedyuk and @nikolay-dementiev for the use cases. (#94, #91, #84) - Improved example code in the
GithubBrowser
example project (#76)
Fixes
ResourceStatusOverlay
now correctly updates its state when it stops observing a resource. (#75)ResourceStatusOverlay
can now be wired up to custom views in a storyboard. (See Breaking Changes below.) (#85, #4)Resource.withParam(…)
now correctly escapes+
in query strings. Thanks, @vvondra, for finding & fixing this. (#97, #96)
Breaking Changes
- The requirements of the
EntityCache
protocol have changed, and several defunct helper types have gone away. See #95 for migration instructions. PipelineStage
now has write-onlycacheUsing(_:)
anddoNotCache()
methods instead of acache
property.- The Objective-C name of
ResourceStatusOverlay
no longer has aBOS
prefix. Storyboards have trouble working with classes whose Swift and Objective-C names are different. This is apparently an Apple bug; dropping the prefix is a workaround.
1.0 beta 8a: Cocoapods fix
Fixes
- Fixed podspec issue which caused “Application does not have valid signature” on iOS devices. (#78)
1.0 beta 8: Pipeline
Enhancements
- The new pipeline API solves several long-standing configuration limitations, and makes service setup code more readable. Thanks to @annicaburns, @alecgorge, @vdka and for the input. (Changes: #64, #70; Motivation: #32, #47)
- Check out the shiny, newly expanded and edited user guide. Now with 32% more useful information!
Fixes
- Fixed issue building for macOS with CocoaPods. Thanks again to @onekiloparsec for driving the macOS work.
- Cleaned up defunct file in project. Thanks, @Alex293. (#66)
- Humorous typo removed, with some regret. Thanks, @sahandnayebaziz. (#65)
Breaking Changes
Service.configureTransformer(...)
now replaces any transformers for themodel
stage with the new one instead of appending it to the end of the entire pipeline. This means that if multiple configuration blocks for the same resource callconfigureTransformer(...)
, the last one wins. This better matches typical user needs; if you want the old behavior, passreplaceExisting: false
.ResponseContentTransformer
no longer skips the transform when the input type already matches the output type. (For example, if the transformer returned a string but there was already a string from upstream in the pipeline, it wouldn’t run.) This behavior is useful but confusing, and shouldn’t be the default. You can enable it withskipWhenEntityMatchesOutputType: true
.- The
EntityCache
protocol has changed. You will need to update your custom cache implementation to accept byte keys instead of string keys.
1.0 beta 7: Bringing OSX-y Back
Enhancements
- Siesta now supports
OS XmacOS. Core functionality all works; UI widgets are still iOS-only. Thanks to the indefatigable @onekiloparsec for seeing this through! (#27, #56) - Configuration can now distinguish between different HTTP methods. This allows, for example, different model mappings for GET and POST responses. (#54)
- Configuration pattern matching now supports
?
to match single characters. This makes it easier to distinguish/items/
(with a trailing slash) from/items/1
. (#55) - You can now pass
NSRegularExpression
as a pattern toService.configure(…)
methods. (#47) - It is now possible to create custom pre-request validation failures via
Resource.failedRequest(…)
. This allows custom pre-validation of requests before they touch the network. Thanks, @vdka! (#44, #50) - You can now limit the number of unused resources Siesta will keep in its internal cache. (#61, #31)
- Added
@warn_unused_result
and@noescape
where appropriate throughout the API. - The code GithubBrowser example project is now a bit tidier & a better Siesta example to work from.
- Example project now uses CocoaPods instead of Carthage, and works with
pod try
. (#58)
Fixes
- Fixed #35: nil-failable blocks passed to
configureTransformer
no longer return double optionals. - Fixed #52: JSON-like content containing non-JSON data no longer causes detailed logging to crash.
- Fixed: When a resource’s last extenernal owner was deallocated, it wasn’t deallocated until a second low memory event. It’s now deallocated on the first.
- Fixed Swift 2.2 deprecations.
Breaking Changes
-
The flavor of
Service.configure(...)
that takes a predicate closure now requires awhenURLMatches:
argument label:// Before service().configure({ $0.path.hasSuffix("foo") }) { ... } // After service().configure(whenURLMatches: { $0.path.hasSuffix("foo") }) { ... }
It was not possible to add a deprecation warning for this change because the deprecated form causes an ambiguous method overloading.
-
Because it only concerned calls bridged from Objective-C,
Error.Cause.InvalidRequestMethod
has moved out of the public Swift API and into the Objective-C bridging API. -
API elements deprecated in 1.0 beta 6 have now been removed.
1.0 beta 6: The hardest problem in computer science
As with all 1.0 beta releases of Siesta, this code is suitable for production use, but is marked “beta” in order to reserve the right to make API adjustments before the official 1.0 release.
-
Prompted by the upcoming 1.0 API freeze and the release of Apple’s new guidelines for Swift APIs, we undertook a complete review of naming choices in Siesta’s API. These will show up as deprecations in your Swift code; the deprecated methods will be removed in the next release. For details, see:
Unfortunately, the Objective-C migration path is not so smooth: because Xcode does not properly copy Swift deprecations to Obj-C header files, the methods that are deprecated in Swift will either silently continue to work from Obj-C code in some cases, and immediately break in others.
-
Methods that should only be called on the main thread now validate this as a precondition.
-
Methods are now marked with
@warn_unused_result
whenever appropriate. -
The user guide has a new section on threading, and there are numerous improvements to the API docs.
-
The internals of
Request
and friends, which had become monolithic and unwieldy, are now broken into several small pieces. (There are no API changes associated with this refactoring.)
1.0 beta 5: Ephemera, Visibilia
As with all 1.0 beta releases of Siesta, this code is suitable for production use, but is marked “beta” in order to reserve the right to make API adjustments before the official 1.0 release.
ephemeralSessionConfiguration
is now the default forService
instances that useNSURLSession
. This is the more secure choice, and thus the better default; it also is more likely to give the desired behavior for 304s.ResourceStatusOverlay
improvements:- Customizable display priority logic (#10)
- Positioning bug fixes
- API docs. Wheee!
- Fixed bug when working with
ResourceEvent.NewData(.Wipe)
from Objective-C
Breaking Changes
- Because of ongoing build issues encountered by several users when using Siesta without the optional Alamofire integration, the Alamofire integration is now in a separate
Extensions
directory, and is not included inSiesta.framework
. You will need to add that source file manually if you want to use the Alamofire integration when including Siesta via Carthage, the binary release, or a git submodule. (CocoaPods users are unaffected by this change.)
API Changes Coming
Beta 6 will include API changes to bring Siesta into better conformance with Apple’s new Swift API guidelines. Please review the proposed changes and give your feedback.
1.0 beta 4: Forget the Alamo (if you want)
- Alamofire is now truly optional when using Siesta as a
.framework
, thanks to Apple (apparently?) fixing problems with optional framework dependencies:- If you have not explicitly configure your Siesta
Service
to use Alamofire and you are using a binary version of Siesta, you can remove it from yourCartfile
. - If you are building Siesta from source (via Carthage or via Xcode), you still need Alamofire (for the build only).
- If you are using Alamofire with Carthage, you must include it in your
Cartfile
yourself. - If you are using Cocoapods, continue to use
pod 'Siesta/Alamofire'
to include Alamofire support.
- If you have not explicitly configure your Siesta
- Fixed: Configuration patterns match whole string instead of substring (e.g.
http://foo.com/**
no longer matcheshttp://bar.com/http://foo.com/
) - Fixed: Configuration patterns cause crash when
Service.baseURL
is nil - Fixed: Invalid request methods and unencodable JSON passed to the Objective-C API now cause request failures instead of crashes
- Code cleanup and refinement (There are now only two forced unwraps in the entire library)
- Clarifications & corrections throughout docs
1.0 beta 3
-
It is now much easier to attach ad hoc content transformation to resources. Use this to inflate models just once, instead of once per observer:
myService.configureTransformer("/widgets/*") { Widget(json: $0.content) }
See
Service.configureTransformer(…)
andResponseContentTransformer
for more info. Big thanks to @radex for helping think this through! -
Cleaned up error handling:
- Siesta now uses publishes programmatically useful values in
Error.cause
. - Siesta no longer narrows any errors to
NSError
in any of its APIs or internal processing. Siesta.Error
now implementsErrorType
, so you can throw it.- All
userMessage
values generated by Siesta are now localizable. Error.isCancellation
removed favor of new error causes (i.e.error.cause is Error.Cause.RequestCancelled
).
- Siesta now uses publishes programmatically useful values in
-
New
ConfigurationPatternConvertible
letsService.wipeResources(…)
do glob-based path matching, and lets you write your own matching mechanisms forconfigure(…)
andwipeResources(…)
. -
Removed deprecated
CFURLCreateStringByAddingPercentEscapes
call. Thanks @paddlefish! -
Siesta now gives empty
NSData
content instead of a request error when the network layer returns a nil response body. -
Fixed: crash when trying to URL-encode strings with unpaired UTF-16 surrogate chars.
-
Fixed: crash when trying to use entity content with struct type from Obj-C. (It now shows up as nil.)
-
Fixed: leaking low memory event observer blocks.
-
Improved GithubBrowser example project.
1.0 beta 2
- Awesome progress reporting!
- Integrates upload, download, and latency into one beautiful number
- Gracefully handles unknown body sizes — even when they suddenly become known
- Makes your app feel faster and your users feel at one with the universe
- Logging improvements: better JSON formatting when dumps enabled, more readable messages
Entity.content
nowAny
instead ofAnyObject
Siesta.Error
now implementsErrorType
contentAsType
default value is now@autoclosure