Skip to content

Commit d6b897a

Browse files
committed
Some updates and readme improvement
1 parent 04faf69 commit d6b897a

File tree

13 files changed

+740
-126
lines changed

13 files changed

+740
-126
lines changed

README.md

Lines changed: 180 additions & 83 deletions
Large diffs are not rendered by default.

ReactiveKit.podspec

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
Pod::Spec.new do |s|
22
s.name = "ReactiveKit"
3-
s.version = "0.0.1"
3+
s.version = "1.0.0"
44
s.summary = "A Swift Reactive Programming Framework"
5+
s.description = "ReactiveKit is a collection of Swift frameworks for reactive and functional reactive programming."
56
s.homepage = "https://github.com/ReactiveKit/ReactiveKit"
67
s.license = 'MIT'
78
s.author = { "Srdan Rasic" => "[email protected]" }
8-
s.source = { :git => "https://github.com/ReactiveKit/ReactiveKit.git" }
9+
s.source = { :git => "https://github.com/ReactiveKit/ReactiveKit.git", :tag => "v1.0.0" }
910

1011
s.ios.deployment_target = '8.0'
1112
s.osx.deployment_target = '10.9'

ReactiveKit.xcodeproj/project.pbxproj

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,14 @@
9797
16C33B851BEFBAC900A0DBE0 /* ReactiveKit.h in Headers */ = {isa = PBXBuildFile; fileRef = ECBCCDD31BEB6B9A00723476 /* ReactiveKit.h */; settings = {ATTRIBUTES = (Public, ); }; };
9898
16F0B8761BEFC3850071847A /* Quick.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 16F0B8751BEFC3850071847A /* Quick.framework */; };
9999
16F0B8781BEFC3890071847A /* Nimble.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 16F0B8771BEFC3890071847A /* Nimble.framework */; };
100+
EC0DF29A1BF48FF400DFF3E6 /* MutableObservable.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC0DF2991BF48FF400DFF3E6 /* MutableObservable.swift */; };
101+
EC0DF29B1BF48FF400DFF3E6 /* MutableObservable.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC0DF2991BF48FF400DFF3E6 /* MutableObservable.swift */; };
102+
EC0DF29C1BF48FF400DFF3E6 /* MutableObservable.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC0DF2991BF48FF400DFF3E6 /* MutableObservable.swift */; };
103+
EC0DF29D1BF48FF400DFF3E6 /* MutableObservable.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC0DF2991BF48FF400DFF3E6 /* MutableObservable.swift */; };
104+
EC0DF29F1BF4909C00DFF3E6 /* MutableObservableCollection.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC0DF29E1BF4909C00DFF3E6 /* MutableObservableCollection.swift */; };
105+
EC0DF2A01BF4909C00DFF3E6 /* MutableObservableCollection.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC0DF29E1BF4909C00DFF3E6 /* MutableObservableCollection.swift */; };
106+
EC0DF2A11BF4909C00DFF3E6 /* MutableObservableCollection.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC0DF29E1BF4909C00DFF3E6 /* MutableObservableCollection.swift */; };
107+
EC0DF2A21BF4909C00DFF3E6 /* MutableObservableCollection.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC0DF29E1BF4909C00DFF3E6 /* MutableObservableCollection.swift */; };
100108
EC835BE21BEC923400463098 /* OperationSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC835BE11BEC923400463098 /* OperationSpec.swift */; };
101109
EC9549B31BF1EFA2000FC2BF /* Result.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1648A99E1BF12CE9007A185C /* Result.swift */; };
102110
EC9549B41BF1EFA3000FC2BF /* Result.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1648A99E1BF12CE9007A185C /* Result.swift */; };
@@ -146,11 +154,15 @@
146154

147155
/* Begin PBXFileReference section */
148156
1648A99E1BF12CE9007A185C /* Result.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Result.swift; sourceTree = "<group>"; };
157+
1671707E1BF4F62A001786CE /* ReactiveKit.podspec */ = {isa = PBXFileReference; lastKnownFileType = text; path = ReactiveKit.podspec; sourceTree = SOURCE_ROOT; };
158+
1671707F1BF4F64E001786CE /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = SOURCE_ROOT; };
149159
16C33AF91BEFB72500A0DBE0 /* ReactiveKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ReactiveKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
150160
16C33B161BEFB9CB00A0DBE0 /* ReactiveKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ReactiveKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
151161
16C33B241BEFBA0100A0DBE0 /* ReactiveKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ReactiveKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
152162
16F0B8751BEFC3850071847A /* Quick.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Quick.framework; path = "../Carthage/Checkouts/Quick/build/Debug-iphoneos/Quick.framework"; sourceTree = "<group>"; };
153163
16F0B8771BEFC3890071847A /* Nimble.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Nimble.framework; path = "../Carthage/Checkouts/Nimble/build/Debug-iphoneos/Nimble.framework"; sourceTree = "<group>"; };
164+
EC0DF2991BF48FF400DFF3E6 /* MutableObservable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MutableObservable.swift; sourceTree = "<group>"; };
165+
EC0DF29E1BF4909C00DFF3E6 /* MutableObservableCollection.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MutableObservableCollection.swift; sourceTree = "<group>"; };
154166
EC835BE11BEC923400463098 /* OperationSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OperationSpec.swift; sourceTree = "<group>"; };
155167
EC835C001BECB0FB00463098 /* ReactiveKitPlayground.playground */ = {isa = PBXFileReference; lastKnownFileType = file.playground; path = ReactiveKitPlayground.playground; sourceTree = SOURCE_ROOT; };
156168
ECBCCDD01BEB6B9A00723476 /* ReactiveKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ReactiveKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -252,6 +264,8 @@
252264
ECBCCDC61BEB6B9A00723476 = {
253265
isa = PBXGroup;
254266
children = (
267+
1671707F1BF4F64E001786CE /* README.md */,
268+
1671707E1BF4F62A001786CE /* ReactiveKit.podspec */,
255269
ECBCCDD21BEB6B9A00723476 /* ReactiveKit */,
256270
EC835BF21BECB0D500463098 /* Playgrounds */,
257271
ECBCCDDE1BEB6B9B00723476 /* ReactiveKitTests */,
@@ -325,6 +339,7 @@
325339
isa = PBXGroup;
326340
children = (
327341
ECBCCDF61BEB6BBE00723476 /* Observable.swift */,
342+
EC0DF2991BF48FF400DFF3E6 /* MutableObservable.swift */,
328343
);
329344
path = Observable;
330345
sourceTree = "<group>";
@@ -337,6 +352,7 @@
337352
ECBCCDFA1BEB6BBE00723476 /* ObservableCollection+Set.swift */,
338353
ECBCCDFB1BEB6BBE00723476 /* ObservableCollection.swift */,
339354
ECBCCDFC1BEB6BBE00723476 /* ObservableCollectionEvent.swift */,
355+
EC0DF29E1BF4909C00DFF3E6 /* MutableObservableCollection.swift */,
340356
);
341357
path = ObservableCollection;
342358
sourceTree = "<group>";
@@ -369,8 +385,8 @@
369385
isa = PBXGroup;
370386
children = (
371387
ECBCCE2C1BEB6BE100723476 /* Operation.swift */,
372-
ECBCCE2D1BEB6BE100723476 /* OperationEvent.swift */,
373388
ECBCCE2E1BEB6BE100723476 /* OperationSink.swift */,
389+
ECBCCE2D1BEB6BE100723476 /* OperationEvent.swift */,
374390
ECBCCE2B1BEB6BE100723476 /* Stream+Operation.swift */,
375391
);
376392
path = Operation;
@@ -602,6 +618,7 @@
602618
16C33B341BEFBA2D00A0DBE0 /* Observable.swift in Sources */,
603619
16C33B331BEFBA2D00A0DBE0 /* Stream+Operation.swift in Sources */,
604620
16C33B421BEFBA2D00A0DBE0 /* StreamBuffer.swift in Sources */,
621+
EC0DF29B1BF48FF400DFF3E6 /* MutableObservable.swift in Sources */,
605622
16C33B431BEFBA2D00A0DBE0 /* NoError.swift in Sources */,
606623
16C33B321BEFBA2D00A0DBE0 /* OperationSink.swift in Sources */,
607624
16C33B401BEFBA2D00A0DBE0 /* Lock.swift in Sources */,
@@ -619,6 +636,7 @@
619636
16C33B481BEFBA2D00A0DBE0 /* TokenizedCollection.swift in Sources */,
620637
16C33B3F1BEFBA2D00A0DBE0 /* SimpleDisposable.swift in Sources */,
621638
16C33B301BEFBA2D00A0DBE0 /* Operation.swift in Sources */,
639+
EC0DF2A01BF4909C00DFF3E6 /* MutableObservableCollection.swift in Sources */,
622640
EC9549B51BF1EFA4000FC2BF /* Result.swift in Sources */,
623641
16C33B351BEFBA2D00A0DBE0 /* ObservableCollection+Array.swift in Sources */,
624642
16C33B461BEFBA2D00A0DBE0 /* OptionalType.swift in Sources */,
@@ -638,6 +656,7 @@
638656
16C33B501BEFBA2D00A0DBE0 /* Observable.swift in Sources */,
639657
16C33B4F1BEFBA2D00A0DBE0 /* Stream+Operation.swift in Sources */,
640658
16C33B5E1BEFBA2D00A0DBE0 /* StreamBuffer.swift in Sources */,
659+
EC0DF29C1BF48FF400DFF3E6 /* MutableObservable.swift in Sources */,
641660
16C33B5F1BEFBA2D00A0DBE0 /* NoError.swift in Sources */,
642661
16C33B4E1BEFBA2D00A0DBE0 /* OperationSink.swift in Sources */,
643662
16C33B5C1BEFBA2D00A0DBE0 /* Lock.swift in Sources */,
@@ -655,6 +674,7 @@
655674
16C33B641BEFBA2D00A0DBE0 /* TokenizedCollection.swift in Sources */,
656675
16C33B5B1BEFBA2D00A0DBE0 /* SimpleDisposable.swift in Sources */,
657676
16C33B4C1BEFBA2D00A0DBE0 /* Operation.swift in Sources */,
677+
EC0DF2A11BF4909C00DFF3E6 /* MutableObservableCollection.swift in Sources */,
658678
EC9549B41BF1EFA3000FC2BF /* Result.swift in Sources */,
659679
16C33B511BEFBA2D00A0DBE0 /* ObservableCollection+Array.swift in Sources */,
660680
16C33B621BEFBA2D00A0DBE0 /* OptionalType.swift in Sources */,
@@ -674,6 +694,7 @@
674694
16C33B6C1BEFBA2E00A0DBE0 /* Observable.swift in Sources */,
675695
16C33B6B1BEFBA2E00A0DBE0 /* Stream+Operation.swift in Sources */,
676696
16C33B7A1BEFBA2E00A0DBE0 /* StreamBuffer.swift in Sources */,
697+
EC0DF29D1BF48FF400DFF3E6 /* MutableObservable.swift in Sources */,
677698
16C33B7B1BEFBA2E00A0DBE0 /* NoError.swift in Sources */,
678699
16C33B6A1BEFBA2E00A0DBE0 /* OperationSink.swift in Sources */,
679700
16C33B781BEFBA2E00A0DBE0 /* Lock.swift in Sources */,
@@ -691,6 +712,7 @@
691712
16C33B801BEFBA2E00A0DBE0 /* TokenizedCollection.swift in Sources */,
692713
16C33B771BEFBA2E00A0DBE0 /* SimpleDisposable.swift in Sources */,
693714
16C33B681BEFBA2E00A0DBE0 /* Operation.swift in Sources */,
715+
EC0DF2A21BF4909C00DFF3E6 /* MutableObservableCollection.swift in Sources */,
694716
EC9549B31BF1EFA2000FC2BF /* Result.swift in Sources */,
695717
16C33B6D1BEFBA2E00A0DBE0 /* ObservableCollection+Array.swift in Sources */,
696718
16C33B7E1BEFBA2E00A0DBE0 /* OptionalType.swift in Sources */,
@@ -710,6 +732,7 @@
710732
ECBCCE211BEB6BBE00723476 /* ActiveStream.swift in Sources */,
711733
ECBCCE101BEB6BBE00723476 /* DisposeBag.swift in Sources */,
712734
ECBCCE1F1BEB6BBE00723476 /* Queue.swift in Sources */,
735+
EC0DF29A1BF48FF400DFF3E6 /* MutableObservable.swift in Sources */,
713736
ECBCCE181BEB6BBE00723476 /* ObservableCollection+Dictionary.swift in Sources */,
714737
ECBCCE311BEB6BE100723476 /* Operation.swift in Sources */,
715738
ECBCCE331BEB6BE100723476 /* OperationSink.swift in Sources */,
@@ -727,6 +750,7 @@
727750
ECBCCE1C1BEB6BBE00723476 /* Bindable.swift in Sources */,
728751
ECBCCE161BEB6BBE00723476 /* Observable.swift in Sources */,
729752
ECBCCE171BEB6BBE00723476 /* ObservableCollection+Array.swift in Sources */,
753+
EC0DF29F1BF4909C00DFF3E6 /* MutableObservableCollection.swift in Sources */,
730754
1648A99F1BF12CE9007A185C /* Result.swift in Sources */,
731755
ECBCCE121BEB6BBE00723476 /* SimpleDisposable.swift in Sources */,
732756
ECBCCE1E1BEB6BBE00723476 /* OptionalType.swift in Sources */,

ReactiveKit/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>FMWK</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>0.1.0</string>
18+
<string>1.0.0</string>
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
//
2+
// The MIT License (MIT)
3+
//
4+
// Copyright (c) 2015 Srdan Rasic (@srdanrasic)
5+
//
6+
// Permission is hereby granted, free of charge, to any person obtaining a copy
7+
// of this software and associated documentation files (the "Software"), to deal
8+
// in the Software without restriction, including without limitation the rights
9+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
// copies of the Software, and to permit persons to whom the Software is
11+
// furnished to do so, subject to the following conditions:
12+
//
13+
// The above copyright notice and this permission notice shall be included in
14+
// all copies or substantial portions of the Software.
15+
//
16+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
// THE SOFTWARE.
23+
//
24+
25+
public struct MutableObservable<Value>: ObservableType {
26+
27+
private var observable: Observable<Value>
28+
29+
public var value: Value {
30+
get {
31+
return observable.value
32+
}
33+
set {
34+
observable.value = newValue
35+
}
36+
}
37+
38+
public init(_ value: Value) {
39+
observable = Observable(value)
40+
}
41+
42+
public func observe(on context: ExecutionContext, sink: Value -> ()) -> DisposableType {
43+
return observable.observe(on: context, sink: sink)
44+
}
45+
}

ReactiveKit/Observable/Observable.swift

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@
2222
// THE SOFTWARE.
2323
//
2424

25-
infix operator <~ { associativity left precedence 160 }
26-
27-
public protocol ObservableType: StreamType {}
25+
public protocol ObservableType: StreamType {
26+
typealias Value
27+
var value: Value { get set }
28+
}
2829

2930
public class Observable<Value>: ActiveStream<Value>, ObservableType {
3031

@@ -33,7 +34,7 @@ public class Observable<Value>: ActiveStream<Value>, ObservableType {
3334
return try! lastEvent()
3435
}
3536
set {
36-
dispatch(newValue)
37+
capturedSink?(value)
3738
}
3839
}
3940

@@ -54,10 +55,6 @@ public class Observable<Value>: ActiveStream<Value>, ObservableType {
5455
return producer(sink)
5556
})
5657
}
57-
58-
public func dispatch(value: Value) {
59-
capturedSink?(value)
60-
}
6158
}
6259

6360
@warn_unused_result
@@ -88,7 +85,3 @@ public extension Observable {
8885
}
8986
}
9087

91-
public func <~ <T>(left: Observable<T>, right: T) {
92-
return left.value = right
93-
}
94-
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
//
2+
// The MIT License (MIT)
3+
//
4+
// Copyright (c) 2015 Srdan Rasic (@srdanrasic)
5+
//
6+
// Permission is hereby granted, free of charge, to any person obtaining a copy
7+
// of this software and associated documentation files (the "Software"), to deal
8+
// in the Software without restriction, including without limitation the rights
9+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
// copies of the Software, and to permit persons to whom the Software is
11+
// furnished to do so, subject to the following conditions:
12+
//
13+
// The above copyright notice and this permission notice shall be included in
14+
// all copies or substantial portions of the Software.
15+
//
16+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
// THE SOFTWARE.
23+
//
24+
25+
public struct MutableObservableCollection<Collection: CollectionType>: ObservableCollectionType {
26+
27+
private var observableCollection: ObservableCollection<Collection>
28+
29+
public var collection: Collection {
30+
get {
31+
return observableCollection.collection
32+
}
33+
}
34+
35+
public init(_ collection: Collection) {
36+
observableCollection = ObservableCollection(collection)
37+
}
38+
39+
public mutating func dispatch(event: ObservableCollectionEvent<Collection>) {
40+
observableCollection.dispatch(event)
41+
}
42+
43+
public func observe(on context: ExecutionContext, sink: ObservableCollectionEvent<Collection> -> ()) -> DisposableType {
44+
return observableCollection.observe(on: context, sink: sink)
45+
}
46+
47+
// MARK: CollectionType conformance
48+
49+
public func generate() -> Collection.Generator {
50+
return collection.generate()
51+
}
52+
53+
public func underestimateCount() -> Int {
54+
return collection.underestimateCount()
55+
}
56+
57+
public var startIndex: Collection.Index {
58+
return collection.startIndex
59+
}
60+
61+
public var endIndex: Collection.Index {
62+
return collection.endIndex
63+
}
64+
65+
public var isEmpty: Bool {
66+
return collection.isEmpty
67+
}
68+
69+
public var count: Collection.Index.Distance {
70+
return collection.count
71+
}
72+
73+
public subscript(index: Collection.Index) -> Collection.Generator.Element {
74+
get {
75+
return collection[index]
76+
}
77+
}
78+
}

0 commit comments

Comments
 (0)