Skip to content

Commit

Permalink
Update Readme and version to 3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
srdanrasic committed Dec 30, 2016
1 parent cfb20d3 commit 854494e
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 29 deletions.
40 changes: 18 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ The framework is best used in a combination with the following extensions:
* [Bond](https://github.com/ReactiveKit/Bond) - UIKit and AppKit bindings, reactive delegates, data sources.
* [ReactiveAlamofire](https://github.com/ReactiveKit/ReactiveAlamofire) - Reactive extensions for Alamofire framework.

**Note: This README describes ReactiveKit v3. For changes check out the [migration section](#migration)!**

## Reactive Programming

Apps transform data. They take some data as input or generate data by themselves, transform that data into another data and output new data to the user. An app could take computer-friendly response from an API, transform it to a user-friendly text with a photo or video and render an article to the user. An app could take readings from the magnetometer, transform them into an orientation angle and render a nice needle to the user. There are many examples, but the pattern is obvious.
Expand Down Expand Up @@ -62,15 +60,15 @@ let counter = Signal<Int, NoError> { observer in

> Producer closure expects you to return a disposable. More about disposables can be found [here](#cancellation).
Notice how we defined signal as `Signal<Int, NoError>`. First generic argument specifies that the signal emits elements of type `Int`. Second one specifies the error type that the signal can error-out with. `NoError` is a type without a constructor so it cannot be initialized. It is used to create signals that cannot error-out, so called _non-failable signals_. This is so common type so ReactiveKit provides a typealias `Signal1` defined as
Notice how we defined signal as `Signal<Int, NoError>`. First generic argument specifies that the signal emits elements of type `Int`. Second one specifies the error type that the signal can error-out with. `NoError` is a type without a constructor so it cannot be initialized. It is used to create signals that cannot error-out, so called _non-failable signals_. This is so common type so ReactiveKit provides a typealias `SafeSignal` defined as

```swift
public typealias Signal1<Element> = Signal<Element, NoError>
public typealias SafeSignal<Element> = Signal<Element, NoError>
```

That means that instead of `Signal<Int, NoError>` you can write just `Signal1<Int>`.
That means that instead of `Signal<Int, NoError>` you can write just `SafeSignal<Int>`.

> The type name `Signal1` might not be the happiest name, but we expect Swift 4 to introduce default generic arguments so we will be able to use just `Signal<Int>`.
> The type name `SafeSignal` might not be the happiest name, but we expect Swift 4 to introduce default generic arguments so we will be able to use just `Signal<Int>`.
When the producer fails to produce the element, you can signal an error. For example, mapping network request could looks like this:

Expand Down Expand Up @@ -101,17 +99,15 @@ The example also shows to use a disposable. When the signal is disposed, the `Bl
These were examples of how to manually create signals. There are few operators in the framework that you can use to create convenient signals. For example, when you need to convert a sequence to a signal, you will use following constructor:

```swift
let counter = Signal1.sequence([1, 2, 3])
let counter = SafeSignal.sequence([1, 2, 3])
```

To create a signal that produces an integer every second, do

```swift
let counter = Signal1<Int>.interval(1, queue: DispatchQueue.main)
let counter = SafeSignal<Int>.interval(1)
```

> Note that this constructor requires a dispatch queue on which the events will be produced.
For more constructors, refer to the code reference.

### Observing Signals
Expand Down Expand Up @@ -171,7 +167,7 @@ or to convert each element to another signal that just triples that element and

```swift
let tripled = counter.flatMapConcat { number in
return Signal1.sequence(Array(count: 3, repeatedValue: number))
return SafeSignal.sequence(Array(count: 3, repeatedValue: number))
}
```

Expand Down Expand Up @@ -203,7 +199,7 @@ Most powerful way is to `flatMapError` into another signal:

```swift
let image = fetchImage(url: ...).flatMapError { error in
return Signal<UIImage> ...
return SafeSignal<UIImage> ...
}
```

Expand Down Expand Up @@ -249,12 +245,12 @@ class X {
...
aSignal.observeNext { _ in
...
}.disposeIn(disposeBag)
}.dispose(in: disposeBag)
}
}
```

> If you are using Bond framework and your class is a subclass or a descendent of NSObject, Bond provides the bag as an extension property `bnd_bag` that you can use out of the box.
> If you are using Bond framework and your class is a subclass or a descendent of NSObject, Bond provides the bag as an extension property `reactive.bag` that you can use out of the box.
Another way to ensure signal disposition is by using bindings instead of observations where possible. They handle everything automatically so you don't have to manually dispose signals.

Expand Down Expand Up @@ -338,20 +334,20 @@ When you want to receive events on a specific dispatch queue, just use `context`
### CocoaPods

```
pod 'ReactiveKit', '~> 3.1'
pod 'Bond', '~> 5.0'
pod 'ReactiveKit', '~> 3.2'
pod 'Bond', '~> 6.0'
```

### Carthage

```
github "ReactiveKit/ReactiveKit" ~> 3.1
github "ReactiveKit/Bond" ~> 5.0
github "ReactiveKit/ReactiveKit" ~> 3.2
github "ReactiveKit/Bond" ~> 6.0
```

## <a name="migration"></a>Migration

### Migration from v2.x to v3.0
### Migration from v2.x to v3.x

There are some big changes in v3. Major one is that ReactiveKit is joining forces with Bond to make great family of frameworks for functional reactive programming. Some things have been moved out of ReactiveKit to Bond in order to make ReactiveKit simpler and focused on FRP, while Bond has been reimplemented on top of ReactiveKit in order to provide great extensions like bindings, reactive delegates or observable collections.

Expand All @@ -364,16 +360,16 @@ What that means for you? Well, nothing has changed conceptually so your migratio
* Operator `toSignal(justLogError:)` has been renamed to `suppressError(logging:)`
* Operators like `takeLast`, `skipLast`, `feedNextInto`, `bindTo` have been renamed to `take(last:)`, `skip(last:)`, `feedNext(into:)`, `bind(to:)` etc.
* Each of the operators `combineLatest`, `zip`, `merge` and `amb` now has overloads for 6 arguments.
* `PushStream` and `PushOperation` have been replaced by `PublishSubject1` and `PublishSubject`.
* `PushStream` and `PushOperation` have been replaced by `SafePublishSubject` and `PublishSubject`.
* `Queue` has been removed. Use `DispatchQueue`.
* `CollectionProperty` has been moved to Bond framework and implemented as three types: `ObservableArray`, `ObservableDictionary` and `ObservableSet`.
* `ProtocolProxy` and other Foundation extensions have been moved to Bond framework. Prefix of extensions has been changed to `bnd`. For example `rBag` is renamed to `bnd_bag`.
* `ProtocolProxy` and other Foundation extensions have been moved to Bond framework. Prefix of extensions has been changed to `reactive`. For example `rBag` is renamed to `reactive.bag`.

## License

The MIT License (MIT)

Copyright (c) 2015-2016 Srdan Rasic (@srdanrasic)
Copyright (c) 2015-2017 Srdan Rasic (@srdanrasic)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 2 additions & 2 deletions ReactiveKit.podspec
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Pod::Spec.new do |s|
s.name = "ReactiveKit"
s.version = "3.1.2"
s.version = "3.2.0"
s.summary = "A Swift Reactive Programming Framework"
s.description = "ReactiveKit is a Swift framework for reactive and functional reactive programming."
s.homepage = "https://github.com/ReactiveKit/ReactiveKit"
s.license = 'MIT'
s.author = { "Srdan Rasic" => "[email protected]" }
s.source = { :git => "https://github.com/ReactiveKit/ReactiveKit.git", :tag => "v3.1.2" }
s.source = { :git => "https://github.com/ReactiveKit/ReactiveKit.git", :tag => "v3.2.0" }

s.ios.deployment_target = '8.0'
s.osx.deployment_target = '10.9'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,19 @@
"DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey" : {
"C1F6A63EF115019142AF6E3E8A173E32E3445DB3" : 0,
"D78924967B5ECB0A1D20E197FAB93ACBFA47F0D1" : 9223372036854775807,
"46F7DF751715C6D9E4FA7D31B7BBF03DFA4C06D4" : 9223372036854775807,
"95438028B10BBB846574013D29F154A00556A9D1" : 0,
"D0725CAC6FF2D66F2C83C2C48DC12106D42DAA64" : 0,
"422BABDE4288A2028DC1FD12E5A5767EA1FD5926" : 0
"422BABDE4288A2028DC1FD12E5A5767EA1FD5926" : 0,
"D0725CAC6FF2D66F2C83C2C48DC12106D42DAA64" : 0
},
"DVTSourceControlWorkspaceBlueprintIdentifierKey" : "DF86A0A1-D0CF-4030-B5AC-6FE303947238",
"DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : {
"C1F6A63EF115019142AF6E3E8A173E32E3445DB3" : "ReactiveKit\/",
"D78924967B5ECB0A1D20E197FAB93ACBFA47F0D1" : "..\/..",
"46F7DF751715C6D9E4FA7D31B7BBF03DFA4C06D4" : "..\/..\/..\/..",
"95438028B10BBB846574013D29F154A00556A9D1" : "ReactiveKit\/Carthage\/Checkouts\/Nimble\/",
"D0725CAC6FF2D66F2C83C2C48DC12106D42DAA64" : "ReactiveKit\/Carthage\/Checkouts\/Quick\/",
"422BABDE4288A2028DC1FD12E5A5767EA1FD5926" : ""
"422BABDE4288A2028DC1FD12E5A5767EA1FD5926" : "",
"D0725CAC6FF2D66F2C83C2C48DC12106D42DAA64" : "ReactiveKit\/Carthage\/Checkouts\/Quick\/"
},
"DVTSourceControlWorkspaceBlueprintNameKey" : "ReactiveKit",
"DVTSourceControlWorkspaceBlueprintVersion" : 204,
Expand All @@ -27,6 +29,11 @@
"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "422BABDE4288A2028DC1FD12E5A5767EA1FD5926"
},
{
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "bitbucket.org:shapedk\/goboat-ios.git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "46F7DF751715C6D9E4FA7D31B7BBF03DFA4C06D4"
},
{
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/Quick\/Nimble.git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
Expand Down
2 changes: 1 addition & 1 deletion ReactiveKit/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>3.1.2</string>
<string>3.2.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down

0 comments on commit 854494e

Please sign in to comment.