This repository has been archived by the owner on Aug 8, 2024. It is now read-only.
Releases: spring-media/Carlos
Releases · spring-media/Carlos
Carlos 0.7
Breaking changes
onCompletion
argument now is a closure accepting aResult<T>
as a parameter instead of a tuple(value: T?, error: ErrorType?)
.Result<T>
is the usualenum
(akaEither
) that can be.Success(T)
,.Error(ErrorType)
orCancelled
in case of canceled computations.- Please add a
import PiedPiper
line everywhere you make use of Carlos'Future
s orPromise
s, since with 0.7 we now ship a separatePied Piper
framework. AsyncComputation
has been removed from the public API. Please useOneWayTransformer
(orCacheLevel
) instead now.
Deprecated
- APIs using closures instead of
Fetcher
,CacheLevel
orOneWayTransformer
parameters are now deprecated in favor of their counterparts. They will be removed from Carlos with the 1.0 release.
New features
- It's now possible to batch a set of fetch requests. You can use
batchGetAll
if you want to pass a list of keys and get the success callback when all of them succeed and the failure callback as soon as one of them fails, orbatchGetSome
if you want to pass a list of keys and get the success callback when all of them completed (successfully or not) but only get the list of successful responses back.
Fixes
- Correctly updates access date on the disk cache when calling
set
on aDiskCacheLevel
0.6
New features
- It's now possible to conditionally post-process values fetched from
CacheLevel
s (or fetch closures) on the key used to fetch the value. Use the functionconditionedPostProcess
or consult theREADME.md
for more information - It's now possible to conditionally transform values fetched from (or set on)
CacheLevel
s on the key used to fetch (or set) the value. Use the functionconditionedValueTransformation
or consult theREADME.md
for more information
Fixes
- Carthage works again
Minor improvements
CacheProvider
now has accessors to retrieve shared instances of the built-in caches (sharedImageCache
,sharedDataCache
andsharedJSONCache
)
0.5
New features
Promise
can now be canceled. Callcancel()
to cancel aPromise
. Be notified of a canceled operation with theonCancel
function. UseonCancel
to setup the cancel behavior of your custom operation. Remember that an operation can only be canceled once, and can only be executing, canceled, failed or succeeded at any given time.- It's now possible to apply a condition to a
OneWayTransformer
. You can callconditioned
on the instance ofOneWayTransformer
to decorate and pass the condition on the input. This means you can effectively implement conditioned key transformations onCacheLevel
s. Moreover, you can implement conditioned post processing transformations as well. For this, though, keep in mind that the input of theOneWayTransformer
will be the output of the cache, not the key. - It's now possible to apply a condition to a
TwoWayTransformer
. You can callconditioned
on the instance ofTwoWayTransformer
to decorate and pass two conditions: the one to apply for the forward transformation and the one to apply for the inverse transformation, that will take of course different input types. This means you can effectively implement conditioned value transformations onCacheLevel
s. - A new
NSUserDefaultsCacheLevel
is now included inCarlos
. You can use thisCacheLevel
to persist values onNSUserDefaults
, and you can even use multiple instances of this level to persist sandboxed sets of values - It's now possible to dispatch a
CacheLevel
or a fetch closure on a given GCD queue. Use thedispatch
protocol extension or the~>>
operator and pass the specificdispatch_queue_t
. Global functions are not provided since we're moving towards a global-functions-free API forCarlos 1.0
Major changes
- API Breaking:
CacheRequest
is now renamed toFuture
. All the public API returnFuture
instances now, and you can usePromise
for your custom cache levels and fetchers - API Breaking:
OneWayTransformer
andTwoWayTransformer
are now asynchronous, i.e. they return aFuture<T>
instead of aT
directly - API Breaking: all the
conditioned
variants now take an asynchronous condition closure, i.e. the closure has to return aFuture<Bool>
instead of a(Bool, ErrorType)
tuple - All the global functions are now deprecated. They will be removed from the public API with the release of
Carlos 1.0
Minor improvements
Promise
can now be initialized with anOptional<T>
and anErrorType
, correctly behaving depending on the optional valuePromise
now has amimic
function that takes aFuture<T>
and succeeds or fails when the givenFuture
does soImageTransformer
now applies its tranformations on a background queueJSONTransformer
now passes the right error when the transformations failCacheProvider.dataCache
now pools requests on the network and disk levels, so pooled requests don't result in multipleset
calls on the disk level- It's now possible to
cancel
operations coming from aNetworkFetcher
Int
,Float
,Double
andCharacter
conform toExpensiveObject
now with a unit (1
) cost- Added a
MIGRATING.md
to the repo and to the Wiki that explains how to migrate to new versions ofCarlos
(only for breaking changes)
0.4
Major changes
- Adds a
Fetcher
protocol that you can use to create your custom fetchers. - Adds the possibility to transform values coming out of
Fetcher
instances throughOneWayTransformer
objects without forcing them to beTwoWayTransformer
as in the case of transforming values ofCacheLevel
instances - Adds a
JSONCache
function toCacheProvider
- Adds output processers to process/sanitize values coming out of
CacheLevel
s (seepostProcess
) - Adds a way to compose multiple
OneWayTransformer
s through functions, operators and protocol extensions - Adds a way to compose multiple
TwoWayTransformer
s through functions, operators and protocol extensions - Adds a
normalize
function and protocol extension transformingCacheLevel
instances intoBasicCache
ones to make it easier to store instance properties - Adds a
JSONTransformer
class conforming toTwoWayTransformer
- Adds a
ImageTransformer
class for the iOS and WatchOS 2 frameworks conforming toTwoWayTransformer
- Adds a
StringTransformer
class conforming toTwoWayTransformer
Minor improvements
invert
is now available as a protocol extension to theTwoWayTransformer
protocol
WatchOS 2
- Adds
WatchOS 2
support throughCocoaPods
tvOS
- Adds framework support for
tvOS
0.3.0
Major notes
- Codebase converted to Swift 2.0
- Adds Watch OS 2 support
- Adds Mac OS X support
API-Breaking changes
CacheRequest.onFailure
now passes anErrorType
instead of anNSError
Enhancements
- Adds an
onCompletion
method to theCacheRequest
class, that will be called in both success and failure cases
0.2
New features
- Includes a
CacheProvider
class to create commonly used caches - Includes a Playground to quickly test Carlos and custom cache architectures
- includes a new
switchLevels
function to have multiple cache lanes
Enhancements
- Improves
DiskCacheLevel
andMemoryCacheLevel
by having protocol-based keys - Defines safer Transformers (either
OneWayTransformer
orTwoWayTransformer
) that return Optionals. If a conversion fails, set operations silently fail and get operations fail with a meaningful error. - Extends the
conditioned
function and the<?>
operator to support fetch closures - Improves the code documentation
Bugfixes
- Fixes an issue where the
NetworkFetcher
would not correctly handle multiple get requests for the same URL
Open Source day
Here we are ready to go open source