-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
04faf69
commit d6b897a
Showing
13 changed files
with
740 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
Pod::Spec.new do |s| | ||
s.name = "ReactiveKit" | ||
s.version = "0.0.1" | ||
s.version = "1.0.0" | ||
s.summary = "A Swift Reactive Programming Framework" | ||
s.description = "ReactiveKit is a collection of Swift frameworks 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" } | ||
s.source = { :git => "https://github.com/ReactiveKit/ReactiveKit.git", :tag => "v1.0.0" } | ||
|
||
s.ios.deployment_target = '8.0' | ||
s.osx.deployment_target = '10.9' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// | ||
// The MIT License (MIT) | ||
// | ||
// Copyright (c) 2015 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 | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
// THE SOFTWARE. | ||
// | ||
|
||
public struct MutableObservable<Value>: ObservableType { | ||
|
||
private var observable: Observable<Value> | ||
|
||
public var value: Value { | ||
get { | ||
return observable.value | ||
} | ||
set { | ||
observable.value = newValue | ||
} | ||
} | ||
|
||
public init(_ value: Value) { | ||
observable = Observable(value) | ||
} | ||
|
||
public func observe(on context: ExecutionContext, sink: Value -> ()) -> DisposableType { | ||
return observable.observe(on: context, sink: sink) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
ReactiveKit/ObservableCollection/MutableObservableCollection.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
// | ||
// The MIT License (MIT) | ||
// | ||
// Copyright (c) 2015 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 | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
// THE SOFTWARE. | ||
// | ||
|
||
public struct MutableObservableCollection<Collection: CollectionType>: ObservableCollectionType { | ||
|
||
private var observableCollection: ObservableCollection<Collection> | ||
|
||
public var collection: Collection { | ||
get { | ||
return observableCollection.collection | ||
} | ||
} | ||
|
||
public init(_ collection: Collection) { | ||
observableCollection = ObservableCollection(collection) | ||
} | ||
|
||
public mutating func dispatch(event: ObservableCollectionEvent<Collection>) { | ||
observableCollection.dispatch(event) | ||
} | ||
|
||
public func observe(on context: ExecutionContext, sink: ObservableCollectionEvent<Collection> -> ()) -> DisposableType { | ||
return observableCollection.observe(on: context, sink: sink) | ||
} | ||
|
||
// MARK: CollectionType conformance | ||
|
||
public func generate() -> Collection.Generator { | ||
return collection.generate() | ||
} | ||
|
||
public func underestimateCount() -> Int { | ||
return collection.underestimateCount() | ||
} | ||
|
||
public var startIndex: Collection.Index { | ||
return collection.startIndex | ||
} | ||
|
||
public var endIndex: Collection.Index { | ||
return collection.endIndex | ||
} | ||
|
||
public var isEmpty: Bool { | ||
return collection.isEmpty | ||
} | ||
|
||
public var count: Collection.Index.Distance { | ||
return collection.count | ||
} | ||
|
||
public subscript(index: Collection.Index) -> Collection.Generator.Element { | ||
get { | ||
return collection[index] | ||
} | ||
} | ||
} |
Oops, something went wrong.