From 32b84112e59b84cf1f0d7b56d63fe51cd0394f05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sr=C4=91an=20Ra=C5=A1i=C4=87?= Date: Wed, 4 Nov 2015 13:36:32 +0100 Subject: [PATCH] Update readme and licence --- README.md | 80 ++++++++++++++++++- rKit.xcodeproj/project.pbxproj | 66 +++++++-------- rKit/Disposables/BlockDisposable.swift | 26 ++++-- rKit/Disposables/CompositeDisposable.swift | 26 ++++-- rKit/Disposables/Disposable.swift | 24 +++++- rKit/Disposables/DisposeBag.swift | 24 +++++- rKit/Disposables/SerialDisposable.swift | 26 ++++-- rKit/Disposables/SimpleDisposable.swift | 24 +++++- rKit/Internals/Lock.swift | 24 +++++- rKit/Internals/Reference.swift | 24 +++++- rKit/Internals/StreamBuffer.swift | 24 +++++- rKit/Observable/Observable.swift | 24 +++++- .../ObservableCollection+Array.swift | 55 ++++++++++++- .../ObservableCollection+Dictionary.swift | 24 +++++- .../ObservableCollection+Set.swift | 24 +++++- .../ObservableCollection.swift | 24 +++++- .../ObservableCollectionEvent.swift | 24 +++++- rKit/Other/Bindable.swift | 24 +++++- rKit/Other/ExecutionContext.swift | 24 +++++- rKit/Other/OptionalType.swift | 24 +++++- rKit/Other/Queue.swift | 26 ++++-- rKit/Other/TokenizedCollection.swift | 30 +++++-- rKit/Streams/ActiveStream.swift | 42 +++++----- rKit/Streams/Stream.swift | 24 +++++- rKit/Streams/StreamType.swift | 24 +++++- rKit/Task/NoError.swift | 24 +++++- rKit/Task/Stream+Task.swift | 24 +++++- rKit/Task/Task.swift | 31 ++++++- rKit/Task/TaskEvent.swift | 24 +++++- rKit/Task/TaskSink.swift | 24 +++++- rKit/rKit.h | 24 +++++- 31 files changed, 742 insertions(+), 170 deletions(-) diff --git a/README.md b/README.md index ff90ec3..5f2c527 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,83 @@ __rKit__ is a collection of Swift frameworks for reactive and functional reactive programming. -* __rKit__ - A core framework that provides cold Stream and hot ActiveStream types and their derivatives Tasks type, Observable type and Observable Array, Dictionary and Set types. -* __rFoundation__ - Foundation framework extensions like type-safe KVO. -* __rUIKit__ - UIKit extensions (bindings). +* [rKit](https://github.com/ReactiveKit/rKit) - A core framework that provides cold Stream and hot ActiveStream types and their derivatives - Tasks, Observable and ObservableCollection types. +* [rFoundation](https://github.com/ReactiveKit/rFoundation) - Foundation framework extensions like type-safe KVO. +* [rUIKit](https://github.com/ReactiveKit/rUIKit) - UIKit extensions (bindings). + +## Observable + +`Observable` type represents observable mutable state, like a variable whose changes can be observed. + +```swift +let name = Observable("Jim") + +name.observe { value in + print(value) +} + +name.value = "Jim Kirk" // prints: Jim Kirk + +name.bindTo(nameLabel.rText) +``` + +## Task + +`Task` type is used to represents asynchronous work that can fail. + +```swift +func fetchImage() -> Task { + + return create { sink in + ... + sink.next(image) + sink.success() + ... + } +} + + +fetchImage().observeNext(on: Queue.Main.contex) { image in + ... +} + +fetchImage().bindTo(imageView.rImage) + +``` + +Each call to task's `observe` method performs separate work. To share results of a single call, use a `shareNext` method. + +```swift +let image = fetchImage().shareNext(on: Queue.Main.context) + +image.bindTo(imageView1) +image.bindTo(imageView2) +``` + +## Streams + +Both Task and Observable are streams that conform to `StreamType` protocol. Streams can be transformed, for example: + +```swift +func fetchAndBlurImage() -> Task { + return fetchImage().map { $0.applyBlur() } +} + +``` + +## ObservableCollection + +`ObservableCollection` is a stream that can be used to encapsulate a collection (array, dictionary or set) and send fine-grained events describing changes that occured. + +```swift +let names: ObservableCollection(["Steve", "Tim"]) + +names.observe { event in + print(event.inserts) +} + +names.append("John") // prints: [2] +``` ## Installation diff --git a/rKit.xcodeproj/project.pbxproj b/rKit.xcodeproj/project.pbxproj index 7519cd3..bd02bd4 100644 --- a/rKit.xcodeproj/project.pbxproj +++ b/rKit.xcodeproj/project.pbxproj @@ -8,36 +8,36 @@ /* Begin PBXBuildFile section */ ECF536B01BE8F4C000015674 /* rKit.h in Headers */ = {isa = PBXBuildFile; fileRef = ECF536AF1BE8F4C000015674 /* rKit.h */; settings = {ATTRIBUTES = (Public, ); }; }; - ECF536B71BE8F4C000015674 /* rKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ECF536AC1BE8F4C000015674 /* rKit.framework */; settings = {ASSET_TAGS = (); }; }; + ECF536B71BE8F4C000015674 /* rKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ECF536AC1BE8F4C000015674 /* rKit.framework */; }; ECF536BC1BE8F4C000015674 /* rKitTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECF536BB1BE8F4C000015674 /* rKitTests.swift */; }; - ECF536E91BE8F50F00015674 /* BlockDisposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECF536C71BE8F50F00015674 /* BlockDisposable.swift */; settings = {ASSET_TAGS = (); }; }; - ECF536EA1BE8F50F00015674 /* CompositeDisposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECF536C81BE8F50F00015674 /* CompositeDisposable.swift */; settings = {ASSET_TAGS = (); }; }; - ECF536EB1BE8F50F00015674 /* Disposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECF536C91BE8F50F00015674 /* Disposable.swift */; settings = {ASSET_TAGS = (); }; }; - ECF536EC1BE8F50F00015674 /* DisposeBag.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECF536CA1BE8F50F00015674 /* DisposeBag.swift */; settings = {ASSET_TAGS = (); }; }; - ECF536ED1BE8F50F00015674 /* SerialDisposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECF536CB1BE8F50F00015674 /* SerialDisposable.swift */; settings = {ASSET_TAGS = (); }; }; - ECF536EE1BE8F50F00015674 /* SimpleDisposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECF536CC1BE8F50F00015674 /* SimpleDisposable.swift */; settings = {ASSET_TAGS = (); }; }; - ECF536EF1BE8F50F00015674 /* Lock.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECF536CE1BE8F50F00015674 /* Lock.swift */; settings = {ASSET_TAGS = (); }; }; - ECF536F01BE8F50F00015674 /* Reference.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECF536CF1BE8F50F00015674 /* Reference.swift */; settings = {ASSET_TAGS = (); }; }; - ECF536F11BE8F50F00015674 /* StreamBuffer.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECF536D01BE8F50F00015674 /* StreamBuffer.swift */; settings = {ASSET_TAGS = (); }; }; - ECF536F21BE8F50F00015674 /* Observable.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECF536D21BE8F50F00015674 /* Observable.swift */; settings = {ASSET_TAGS = (); }; }; - ECF536F31BE8F50F00015674 /* ObservableCollection+Array.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECF536D41BE8F50F00015674 /* ObservableCollection+Array.swift */; settings = {ASSET_TAGS = (); }; }; - ECF536F41BE8F50F00015674 /* ObservableCollection+Dictionary.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECF536D51BE8F50F00015674 /* ObservableCollection+Dictionary.swift */; settings = {ASSET_TAGS = (); }; }; - ECF536F51BE8F50F00015674 /* ObservableCollection+Set.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECF536D61BE8F50F00015674 /* ObservableCollection+Set.swift */; settings = {ASSET_TAGS = (); }; }; - ECF536F61BE8F50F00015674 /* ObservableCollection.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECF536D71BE8F50F00015674 /* ObservableCollection.swift */; settings = {ASSET_TAGS = (); }; }; - ECF536F71BE8F50F00015674 /* ObservableCollectionEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECF536D81BE8F50F00015674 /* ObservableCollectionEvent.swift */; settings = {ASSET_TAGS = (); }; }; - ECF536F81BE8F50F00015674 /* Bindable.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECF536DA1BE8F50F00015674 /* Bindable.swift */; settings = {ASSET_TAGS = (); }; }; - ECF536F91BE8F50F00015674 /* ExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECF536DB1BE8F50F00015674 /* ExecutionContext.swift */; settings = {ASSET_TAGS = (); }; }; - ECF536FA1BE8F50F00015674 /* OptionalType.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECF536DC1BE8F50F00015674 /* OptionalType.swift */; settings = {ASSET_TAGS = (); }; }; - ECF536FB1BE8F50F00015674 /* Queue.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECF536DD1BE8F50F00015674 /* Queue.swift */; settings = {ASSET_TAGS = (); }; }; - ECF536FC1BE8F50F00015674 /* TokenizedCollection.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECF536DE1BE8F50F00015674 /* TokenizedCollection.swift */; settings = {ASSET_TAGS = (); }; }; - ECF536FD1BE8F50F00015674 /* ActiveStream.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECF536E01BE8F50F00015674 /* ActiveStream.swift */; settings = {ASSET_TAGS = (); }; }; - ECF536FE1BE8F50F00015674 /* Stream.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECF536E11BE8F50F00015674 /* Stream.swift */; settings = {ASSET_TAGS = (); }; }; - ECF536FF1BE8F50F00015674 /* StreamType.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECF536E21BE8F50F00015674 /* StreamType.swift */; settings = {ASSET_TAGS = (); }; }; - ECF537001BE8F50F00015674 /* NoError.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECF536E41BE8F50F00015674 /* NoError.swift */; settings = {ASSET_TAGS = (); }; }; - ECF537011BE8F50F00015674 /* Stream+Task.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECF536E51BE8F50F00015674 /* Stream+Task.swift */; settings = {ASSET_TAGS = (); }; }; - ECF537021BE8F50F00015674 /* Task.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECF536E61BE8F50F00015674 /* Task.swift */; settings = {ASSET_TAGS = (); }; }; - ECF537031BE8F50F00015674 /* TaskEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECF536E71BE8F50F00015674 /* TaskEvent.swift */; settings = {ASSET_TAGS = (); }; }; - ECF537041BE8F50F00015674 /* TaskSink.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECF536E81BE8F50F00015674 /* TaskSink.swift */; settings = {ASSET_TAGS = (); }; }; + ECF536E91BE8F50F00015674 /* BlockDisposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECF536C71BE8F50F00015674 /* BlockDisposable.swift */; }; + ECF536EA1BE8F50F00015674 /* CompositeDisposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECF536C81BE8F50F00015674 /* CompositeDisposable.swift */; }; + ECF536EB1BE8F50F00015674 /* Disposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECF536C91BE8F50F00015674 /* Disposable.swift */; }; + ECF536EC1BE8F50F00015674 /* DisposeBag.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECF536CA1BE8F50F00015674 /* DisposeBag.swift */; }; + ECF536ED1BE8F50F00015674 /* SerialDisposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECF536CB1BE8F50F00015674 /* SerialDisposable.swift */; }; + ECF536EE1BE8F50F00015674 /* SimpleDisposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECF536CC1BE8F50F00015674 /* SimpleDisposable.swift */; }; + ECF536EF1BE8F50F00015674 /* Lock.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECF536CE1BE8F50F00015674 /* Lock.swift */; }; + ECF536F01BE8F50F00015674 /* Reference.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECF536CF1BE8F50F00015674 /* Reference.swift */; }; + ECF536F11BE8F50F00015674 /* StreamBuffer.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECF536D01BE8F50F00015674 /* StreamBuffer.swift */; }; + ECF536F21BE8F50F00015674 /* Observable.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECF536D21BE8F50F00015674 /* Observable.swift */; }; + ECF536F31BE8F50F00015674 /* ObservableCollection+Array.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECF536D41BE8F50F00015674 /* ObservableCollection+Array.swift */; }; + ECF536F41BE8F50F00015674 /* ObservableCollection+Dictionary.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECF536D51BE8F50F00015674 /* ObservableCollection+Dictionary.swift */; }; + ECF536F51BE8F50F00015674 /* ObservableCollection+Set.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECF536D61BE8F50F00015674 /* ObservableCollection+Set.swift */; }; + ECF536F61BE8F50F00015674 /* ObservableCollection.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECF536D71BE8F50F00015674 /* ObservableCollection.swift */; }; + ECF536F71BE8F50F00015674 /* ObservableCollectionEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECF536D81BE8F50F00015674 /* ObservableCollectionEvent.swift */; }; + ECF536F81BE8F50F00015674 /* Bindable.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECF536DA1BE8F50F00015674 /* Bindable.swift */; }; + ECF536F91BE8F50F00015674 /* ExecutionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECF536DB1BE8F50F00015674 /* ExecutionContext.swift */; }; + ECF536FA1BE8F50F00015674 /* OptionalType.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECF536DC1BE8F50F00015674 /* OptionalType.swift */; }; + ECF536FB1BE8F50F00015674 /* Queue.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECF536DD1BE8F50F00015674 /* Queue.swift */; }; + ECF536FC1BE8F50F00015674 /* TokenizedCollection.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECF536DE1BE8F50F00015674 /* TokenizedCollection.swift */; }; + ECF536FD1BE8F50F00015674 /* ActiveStream.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECF536E01BE8F50F00015674 /* ActiveStream.swift */; }; + ECF536FE1BE8F50F00015674 /* Stream.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECF536E11BE8F50F00015674 /* Stream.swift */; }; + ECF536FF1BE8F50F00015674 /* StreamType.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECF536E21BE8F50F00015674 /* StreamType.swift */; }; + ECF537001BE8F50F00015674 /* NoError.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECF536E41BE8F50F00015674 /* NoError.swift */; }; + ECF537011BE8F50F00015674 /* Stream+Task.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECF536E51BE8F50F00015674 /* Stream+Task.swift */; }; + ECF537021BE8F50F00015674 /* Task.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECF536E61BE8F50F00015674 /* Task.swift */; }; + ECF537031BE8F50F00015674 /* TaskEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECF536E71BE8F50F00015674 /* TaskEvent.swift */; }; + ECF537041BE8F50F00015674 /* TaskSink.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECF536E81BE8F50F00015674 /* TaskSink.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -207,8 +207,8 @@ ECF536DF1BE8F50F00015674 /* Streams */ = { isa = PBXGroup; children = ( - ECF536E01BE8F50F00015674 /* ActiveStream.swift */, ECF536E11BE8F50F00015674 /* Stream.swift */, + ECF536E01BE8F50F00015674 /* ActiveStream.swift */, ECF536E21BE8F50F00015674 /* StreamType.swift */, ); path = Streams; @@ -218,10 +218,10 @@ isa = PBXGroup; children = ( ECF536E41BE8F50F00015674 /* NoError.swift */, - ECF536E51BE8F50F00015674 /* Stream+Task.swift */, ECF536E61BE8F50F00015674 /* Task.swift */, - ECF536E71BE8F50F00015674 /* TaskEvent.swift */, ECF536E81BE8F50F00015674 /* TaskSink.swift */, + ECF536E71BE8F50F00015674 /* TaskEvent.swift */, + ECF536E51BE8F50F00015674 /* Stream+Task.swift */, ); path = Task; sourceTree = ""; @@ -543,6 +543,7 @@ ECF536C21BE8F4C000015674 /* Release */, ); defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; }; ECF536C31BE8F4C000015674 /* Build configuration list for PBXNativeTarget "rKitTests" */ = { isa = XCConfigurationList; @@ -551,6 +552,7 @@ ECF536C51BE8F4C000015674 /* Release */, ); defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; diff --git a/rKit/Disposables/BlockDisposable.swift b/rKit/Disposables/BlockDisposable.swift index a80b2dd..203ec24 100644 --- a/rKit/Disposables/BlockDisposable.swift +++ b/rKit/Disposables/BlockDisposable.swift @@ -1,9 +1,25 @@ // -// BlockDisposable.swift -// Streams +// The MIT License (MIT) // -// Created by Srdan Rasic on 18/10/15. -// Copyright © 2015 Srdan Rasic. All rights reserved. +// 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. // /// A disposable that executes the given block upon disposing. @@ -14,7 +30,7 @@ public final class BlockDisposable: DisposableType { } private var handler: (() -> ())? - private let lock = RecursiveLock(name: "com.swift-bond.Bond.BlockDisposable") + private let lock = RecursiveLock(name: "com.rkit.rkit.BlockDisposable") public init(_ handler: () -> ()) { self.handler = handler diff --git a/rKit/Disposables/CompositeDisposable.swift b/rKit/Disposables/CompositeDisposable.swift index 8b34ab3..2988cee 100644 --- a/rKit/Disposables/CompositeDisposable.swift +++ b/rKit/Disposables/CompositeDisposable.swift @@ -1,9 +1,25 @@ // -// CompositeDisposable.swift -// Streams +// The MIT License (MIT) // -// Created by Srdan Rasic on 18/10/15. -// Copyright © 2015 Srdan Rasic. All rights reserved. +// 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. // /// A disposable that disposes a collection of disposables upon disposing. @@ -11,7 +27,7 @@ public final class CompositeDisposable: DisposableType { public private(set) var isDisposed: Bool = false private var disposables: [DisposableType] = [] - private let lock = RecursiveLock(name: "com.swift-bond.Bond.CompositeDisposable") + private let lock = RecursiveLock(name: "com.rkit.rkit.CompositeDisposable") public convenience init() { self.init([]) diff --git a/rKit/Disposables/Disposable.swift b/rKit/Disposables/Disposable.swift index d591ff5..dbc5f3d 100644 --- a/rKit/Disposables/Disposable.swift +++ b/rKit/Disposables/Disposable.swift @@ -1,9 +1,25 @@ // -// Disposable.swift -// Streams +// The MIT License (MIT) // -// Created by Srdan Rasic on 18/10/15. -// Copyright © 2015 Srdan Rasic. All rights reserved. +// 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. // /// Objects conforming to this protocol can dispose or cancel connection or task. diff --git a/rKit/Disposables/DisposeBag.swift b/rKit/Disposables/DisposeBag.swift index 8aa76c3..f490d02 100644 --- a/rKit/Disposables/DisposeBag.swift +++ b/rKit/Disposables/DisposeBag.swift @@ -1,9 +1,25 @@ // -// DisposeBag.swift -// Streams +// The MIT License (MIT) // -// Created by Srdan Rasic on 18/10/15. -// Copyright © 2015 Srdan Rasic. All rights reserved. +// 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. // /// A disposable container that will dispose a collection of disposables upon deinit. diff --git a/rKit/Disposables/SerialDisposable.swift b/rKit/Disposables/SerialDisposable.swift index d7c0330..e918458 100644 --- a/rKit/Disposables/SerialDisposable.swift +++ b/rKit/Disposables/SerialDisposable.swift @@ -1,16 +1,32 @@ // -// SerialDisposable.swift -// Streams +// The MIT License (MIT) // -// Created by Srdan Rasic on 18/10/15. -// Copyright © 2015 Srdan Rasic. All rights reserved. +// 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. // /// A disposable that disposes other disposable. public final class SerialDisposable: DisposableType { public private(set) var isDisposed: Bool = false - private let lock = RecursiveLock(name: "com.swift-bond.Bond.SerialDisposable") + private let lock = RecursiveLock(name: "com.rkit.rkit.SerialDisposable") /// Will dispose other disposable immediately if self is already disposed. public var otherDisposable: DisposableType? { diff --git a/rKit/Disposables/SimpleDisposable.swift b/rKit/Disposables/SimpleDisposable.swift index 937c28a..8b4c22a 100644 --- a/rKit/Disposables/SimpleDisposable.swift +++ b/rKit/Disposables/SimpleDisposable.swift @@ -1,9 +1,25 @@ // -// SimpleDisposable.swift -// Streams +// The MIT License (MIT) // -// Created by Srdan Rasic on 18/10/15. -// Copyright © 2015 Srdan Rasic. All rights reserved. +// 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. // /// A disposable that just encapsulates disposed state. diff --git a/rKit/Internals/Lock.swift b/rKit/Internals/Lock.swift index a227228..ebc91d2 100644 --- a/rKit/Internals/Lock.swift +++ b/rKit/Internals/Lock.swift @@ -1,9 +1,25 @@ // -// Lock.swift -// Streams +// The MIT License (MIT) // -// Created by Srdan Rasic on 18/10/15. -// Copyright © 2015 Srdan Rasic. All rights reserved. +// 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. // import Foundation diff --git a/rKit/Internals/Reference.swift b/rKit/Internals/Reference.swift index 99afd3a..edeb4ce 100644 --- a/rKit/Internals/Reference.swift +++ b/rKit/Internals/Reference.swift @@ -1,9 +1,25 @@ // -// Reference.swift -// Streams +// The MIT License (MIT) // -// Created by Srdan Rasic on 20/10/15. -// Copyright © 2015 Srdan Rasic. All rights reserved. +// 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. // /// A simple wrapper around an optional that can retain or release given optional at will. diff --git a/rKit/Internals/StreamBuffer.swift b/rKit/Internals/StreamBuffer.swift index 12bc0c6..0608d88 100644 --- a/rKit/Internals/StreamBuffer.swift +++ b/rKit/Internals/StreamBuffer.swift @@ -1,9 +1,25 @@ // -// StreamBuffer.swift -// Streams +// The MIT License (MIT) // -// Created by Srdan Rasic on 18/10/15. -// Copyright © 2015 Srdan Rasic. All rights reserved. +// 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 class StreamBuffer { diff --git a/rKit/Observable/Observable.swift b/rKit/Observable/Observable.swift index 203b52d..da3e8d5 100644 --- a/rKit/Observable/Observable.swift +++ b/rKit/Observable/Observable.swift @@ -1,9 +1,25 @@ // -// ObservableValue.swift -// rCollections +// The MIT License (MIT) // -// Created by Srdan Rasic on 30/10/15. -// Copyright © 2015 Srdan Rasic. All rights reserved. +// 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. // infix operator <~ { associativity left precedence 160 } diff --git a/rKit/ObservableCollection/ObservableCollection+Array.swift b/rKit/ObservableCollection/ObservableCollection+Array.swift index 01b85dd..ae29903 100644 --- a/rKit/ObservableCollection/ObservableCollection+Array.swift +++ b/rKit/ObservableCollection/ObservableCollection+Array.swift @@ -1,9 +1,25 @@ // -// ObservableArray.swift -// Collections +// The MIT License (MIT) // -// Created by Srdan Rasic on 20/10/15. -// Copyright © 2015 Srdan Rasic. All rights reserved. +// 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 extension ObservableCollectionType where Collection == Array { @@ -14,12 +30,43 @@ public extension ObservableCollectionType where Collection == Array Collection.Generator.Element { + var new = collection + let element = new.removeAtIndex(index) + dispatch(ObservableCollectionEvent(collection: new, inserts: [], deletes: [index], updates: [])) + return element + } + + public mutating func removeLast() -> Collection.Generator.Element { + var new = collection + let element = new.removeLast() + dispatch(ObservableCollectionEvent(collection: new, inserts: [], deletes: [new.count], updates: [])) + return element + } + + public mutating func removeAll() { + let deletes = Array(0.. Collection.Generator.Element { get { return self[index] diff --git a/rKit/ObservableCollection/ObservableCollection+Dictionary.swift b/rKit/ObservableCollection/ObservableCollection+Dictionary.swift index 3feb1cf..44b819f 100644 --- a/rKit/ObservableCollection/ObservableCollection+Dictionary.swift +++ b/rKit/ObservableCollection/ObservableCollection+Dictionary.swift @@ -1,9 +1,25 @@ // -// ObservableDictionary.swift -// Collections +// The MIT License (MIT) // -// Created by Srdan Rasic on 20/10/15. -// Copyright © 2015 Srdan Rasic. All rights reserved. +// 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 protocol DictionaryIndexType { diff --git a/rKit/ObservableCollection/ObservableCollection+Set.swift b/rKit/ObservableCollection/ObservableCollection+Set.swift index 2f15bf4..efd4a30 100644 --- a/rKit/ObservableCollection/ObservableCollection+Set.swift +++ b/rKit/ObservableCollection/ObservableCollection+Set.swift @@ -1,9 +1,25 @@ // -// ObservableSet.swift -// Collections +// The MIT License (MIT) // -// Created by Srdan Rasic on 20/10/15. -// Copyright © 2015 Srdan Rasic. All rights reserved. +// 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. // extension ObservableCollectionType where Generator.Element: Hashable, Collection == Set { diff --git a/rKit/ObservableCollection/ObservableCollection.swift b/rKit/ObservableCollection/ObservableCollection.swift index e4132e5..4ed67a5 100644 --- a/rKit/ObservableCollection/ObservableCollection.swift +++ b/rKit/ObservableCollection/ObservableCollection.swift @@ -1,9 +1,25 @@ // -// ObservableCollection.swift -// Collections +// The MIT License (MIT) // -// Created by Srdan Rasic on 20/10/15. -// Copyright © 2015 Srdan Rasic. All rights reserved. +// 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 protocol ObservableCollectionType: CollectionType, StreamType { diff --git a/rKit/ObservableCollection/ObservableCollectionEvent.swift b/rKit/ObservableCollection/ObservableCollectionEvent.swift index 398642a..d1efd4f 100644 --- a/rKit/ObservableCollection/ObservableCollectionEvent.swift +++ b/rKit/ObservableCollection/ObservableCollectionEvent.swift @@ -1,9 +1,25 @@ // -// ObservableCollectionEvent.swift -// Collections +// The MIT License (MIT) // -// Created by Srdan Rasic on 20/10/15. -// Copyright © 2015 Srdan Rasic. All rights reserved. +// 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 protocol ObservableCollectionEventType { diff --git a/rKit/Other/Bindable.swift b/rKit/Other/Bindable.swift index 88e680f..1e998a9 100644 --- a/rKit/Other/Bindable.swift +++ b/rKit/Other/Bindable.swift @@ -1,9 +1,25 @@ // -// Bindable.swift -// rStreams +// The MIT License (MIT) // -// Created by Srdan Rasic on 25/10/15. -// Copyright © 2015 Srdan Rasic. All rights reserved. +// 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 protocol BindableType { diff --git a/rKit/Other/ExecutionContext.swift b/rKit/Other/ExecutionContext.swift index 5e27c2c..bf485df 100644 --- a/rKit/Other/ExecutionContext.swift +++ b/rKit/Other/ExecutionContext.swift @@ -1,9 +1,25 @@ // -// ExecutionContext.swift -// Streams +// The MIT License (MIT) // -// Created by Srdan Rasic on 25/10/15. -// Copyright © 2015 Srdan Rasic. All rights reserved. +// 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 typealias ExecutionContext = (() -> Void) -> Void diff --git a/rKit/Other/OptionalType.swift b/rKit/Other/OptionalType.swift index e57aab3..56d7f21 100644 --- a/rKit/Other/OptionalType.swift +++ b/rKit/Other/OptionalType.swift @@ -1,9 +1,25 @@ // -// Optional.swift -// rStreams +// The MIT License (MIT) // -// Created by Srdan Rasic on 30/10/15. -// Copyright © 2015 Srdan Rasic. All rights reserved. +// 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 protocol OptionalType { diff --git a/rKit/Other/Queue.swift b/rKit/Other/Queue.swift index a2d544e..c275fb8 100644 --- a/rKit/Other/Queue.swift +++ b/rKit/Other/Queue.swift @@ -1,9 +1,25 @@ // -// Queue.swift -// Streams +// The MIT License (MIT) // -// Created by Srdan Rasic on 20/10/15. -// Copyright © 2015 Srdan Rasic. All rights reserved. +// 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. // import Dispatch @@ -20,7 +36,7 @@ public struct Queue { public private(set) var queue: dispatch_queue_t - public init(queue: dispatch_queue_t = dispatch_queue_create("com.swift-bond.Bond.Queue", DISPATCH_QUEUE_SERIAL)) { + public init(queue: dispatch_queue_t = dispatch_queue_create("com.rkit.rkit.Queue", DISPATCH_QUEUE_SERIAL)) { self.queue = queue } diff --git a/rKit/Other/TokenizedCollection.swift b/rKit/Other/TokenizedCollection.swift index d69bdea..91f47b5 100644 --- a/rKit/Other/TokenizedCollection.swift +++ b/rKit/Other/TokenizedCollection.swift @@ -1,9 +1,25 @@ // -// TokenizedCollection.swift -// rStreams +// The MIT License (MIT) // -// Created by Srdan Rasic on 02/11/15. -// Copyright © 2015 Srdan Rasic. All rights reserved. +// 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 class TokenizedCollection { @@ -11,7 +27,11 @@ public class TokenizedCollection { private var storage: [Token:T] = [:] private var nextToken: Token = 0 - private let lock = RecursiveLock(name: "com.ReactiveKit.rStreams.TokenizedCollection") + private let lock = RecursiveLock(name: "com.rkit.rkit.TokenizedCollection") + + public var count: Int { + return storage.count + } public init() {} diff --git a/rKit/Streams/ActiveStream.swift b/rKit/Streams/ActiveStream.swift index f061baa..a707d3b 100644 --- a/rKit/Streams/ActiveStream.swift +++ b/rKit/Streams/ActiveStream.swift @@ -1,9 +1,25 @@ // -// SharedProducer.swift -// Streams +// The MIT License (MIT) // -// Created by Srdan Rasic on 18/10/15. -// Copyright © 2015 Srdan Rasic. All rights reserved. +// 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 protocol ActiveStreamType: StreamType { @@ -17,9 +33,8 @@ public class ActiveStream: ActiveStreamType { private typealias Token = Int64 - private var observers: [Token:Sink] = [:] - private var nextToken: Token = 0 - private let lock = RecursiveLock(name: "com.swift-bond.Bond.EventProducer") + private var observers = TokenizedCollection() + private let lock = RecursiveLock(name: "com.rkit.rkit.ActiveStream") private var isDispatchInProgress: Bool = false private let deinitDisposable = CompositeDisposable() @@ -88,7 +103,7 @@ public class ActiveStream: ActiveStreamType { lock.lock() isDispatchInProgress = true - for (_, send) in observers { + observers.forEach { send in send(event) } isDispatchInProgress = false @@ -96,16 +111,7 @@ public class ActiveStream: ActiveStreamType { } private func registerObserver(observer: Sink) -> DisposableType { - lock.lock() - let token = nextToken - nextToken = nextToken + 1 - lock.unlock() - - observers[token] = observer - - return BlockDisposable { [weak self] in - self?.observers.removeValueForKey(token) - } + return observers.insert(observer) } deinit { diff --git a/rKit/Streams/Stream.swift b/rKit/Streams/Stream.swift index cc89d07..460da0d 100644 --- a/rKit/Streams/Stream.swift +++ b/rKit/Streams/Stream.swift @@ -1,9 +1,25 @@ // -// LazyProducer.swift -// Streams +// The MIT License (MIT) // -// Created by Srdan Rasic on 18/10/15. -// Copyright © 2015 Srdan Rasic. All rights reserved. +// 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 Stream: StreamType { diff --git a/rKit/Streams/StreamType.swift b/rKit/Streams/StreamType.swift index e3e355a..453b0a3 100644 --- a/rKit/Streams/StreamType.swift +++ b/rKit/Streams/StreamType.swift @@ -1,9 +1,25 @@ // -// Stream.swift -// Streams +// The MIT License (MIT) // -// Created by Srdan Rasic on 18/10/15. -// Copyright © 2015 Srdan Rasic. All rights reserved. +// 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 protocol StreamType { diff --git a/rKit/Task/NoError.swift b/rKit/Task/NoError.swift index 2558dd8..841c23d 100644 --- a/rKit/Task/NoError.swift +++ b/rKit/Task/NoError.swift @@ -1,9 +1,25 @@ // -// NoError.swift -// rTasks +// The MIT License (MIT) // -// Created by Srdan Rasic on 30/10/15. -// Copyright © 2015 Srdan Rasic. All rights reserved. +// 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 enum NoError: ErrorType { diff --git a/rKit/Task/Stream+Task.swift b/rKit/Task/Stream+Task.swift index 965b865..3fa2188 100644 --- a/rKit/Task/Stream+Task.swift +++ b/rKit/Task/Stream+Task.swift @@ -1,9 +1,25 @@ // -// Stream+Task.swift -// rTasks +// The MIT License (MIT) // -// Created by Srdan Rasic on 01/11/15. -// Copyright © 2015 Srdan Rasic. All rights reserved. +// 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 extension StreamType where Event: TaskType { diff --git a/rKit/Task/Task.swift b/rKit/Task/Task.swift index 551e4e0..2ba1826 100644 --- a/rKit/Task/Task.swift +++ b/rKit/Task/Task.swift @@ -1,9 +1,25 @@ // -// Task.swift -// rTasks +// The MIT License (MIT) // -// Created by Srdan Rasic on 30/10/15. -// Copyright © 2015 Srdan Rasic. All rights reserved. +// 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 protocol TaskType: StreamType { @@ -89,6 +105,13 @@ public extension TaskType { } } + @warn_unused_result + public func shareNext(limit: Int = Int.max, context: ExecutionContext = Queue.Main.context) -> ActiveStream { + return create(limit) { sink in + return self.observeNext(on: context, sink: sink) + } + } + @warn_unused_result public func map(transform: Value -> U) -> Task { return lift { $0.map { $0.map(transform) } } diff --git a/rKit/Task/TaskEvent.swift b/rKit/Task/TaskEvent.swift index 8acc44f..d36836a 100644 --- a/rKit/Task/TaskEvent.swift +++ b/rKit/Task/TaskEvent.swift @@ -1,9 +1,25 @@ // -// TaskEvent.swift -// rTasks +// The MIT License (MIT) // -// Created by Srdan Rasic on 30/10/15. -// Copyright © 2015 Srdan Rasic. All rights reserved. +// 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 protocol TaskEventType { diff --git a/rKit/Task/TaskSink.swift b/rKit/Task/TaskSink.swift index 8d6bad4..bfd514e 100644 --- a/rKit/Task/TaskSink.swift +++ b/rKit/Task/TaskSink.swift @@ -1,9 +1,25 @@ // -// TaskSink.swift -// rTasks +// The MIT License (MIT) // -// Created by Srdan Rasic on 30/10/15. -// Copyright © 2015 Srdan Rasic. All rights reserved. +// 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 TaskSink { diff --git a/rKit/rKit.h b/rKit/rKit.h index 2e95a27..b9403e4 100644 --- a/rKit/rKit.h +++ b/rKit/rKit.h @@ -1,9 +1,25 @@ // -// rKit.h -// rKit +// The MIT License (MIT) // -// Created by Srdan Rasic on 03/11/15. -// Copyright © 2015 Srdan Rasic. All rights reserved. +// 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. // #import