Update outdated pods.
This commit is contained in:
10
Podfile.lock
10
Podfile.lock
@ -5,9 +5,9 @@ PODS:
|
||||
- GCDWebServer/Core (= 3.3.3)
|
||||
- GCDWebServer/Core (3.3.3)
|
||||
- MASShortcut (2.3.6)
|
||||
- RxCocoa (3.1.0):
|
||||
- RxSwift (~> 3.1)
|
||||
- RxSwift (3.1.0)
|
||||
- RxCocoa (3.3.1):
|
||||
- RxSwift (~> 3.3)
|
||||
- RxSwift (3.3.1)
|
||||
|
||||
DEPENDENCIES:
|
||||
- Alamofire (~> 4.2.0)
|
||||
@ -22,8 +22,8 @@ SPEC CHECKSUMS:
|
||||
BRLOptionParser: a03256a8ff003ca1f5376c55f55f210e085a3958
|
||||
GCDWebServer: 1c39a1f0763e4eb492bee021e4270fce097d3555
|
||||
MASShortcut: 9c215e8a8a78f3d01ce56da48e2730ab66b538fa
|
||||
RxCocoa: 50d7564866da9299161e86a263ce12a0873904d8
|
||||
RxSwift: 83ff553e7593fdfdcb2562933a64c0284dffdadc
|
||||
RxCocoa: 7dcb7a1860fc9cd0e23dae67ab105fc2916670b6
|
||||
RxSwift: 8fc9f2de6275a9101d518444e00bf32f1a42caac
|
||||
|
||||
PODFILE CHECKSUM: e59f622df37d0fe135432c1ccda243973c311def
|
||||
|
||||
|
10
Pods/Manifest.lock
generated
10
Pods/Manifest.lock
generated
@ -5,9 +5,9 @@ PODS:
|
||||
- GCDWebServer/Core (= 3.3.3)
|
||||
- GCDWebServer/Core (3.3.3)
|
||||
- MASShortcut (2.3.6)
|
||||
- RxCocoa (3.1.0):
|
||||
- RxSwift (~> 3.1)
|
||||
- RxSwift (3.1.0)
|
||||
- RxCocoa (3.3.1):
|
||||
- RxSwift (~> 3.3)
|
||||
- RxSwift (3.3.1)
|
||||
|
||||
DEPENDENCIES:
|
||||
- Alamofire (~> 4.2.0)
|
||||
@ -22,8 +22,8 @@ SPEC CHECKSUMS:
|
||||
BRLOptionParser: a03256a8ff003ca1f5376c55f55f210e085a3958
|
||||
GCDWebServer: 1c39a1f0763e4eb492bee021e4270fce097d3555
|
||||
MASShortcut: 9c215e8a8a78f3d01ce56da48e2730ab66b538fa
|
||||
RxCocoa: 50d7564866da9299161e86a263ce12a0873904d8
|
||||
RxSwift: 83ff553e7593fdfdcb2562933a64c0284dffdadc
|
||||
RxCocoa: 7dcb7a1860fc9cd0e23dae67ab105fc2916670b6
|
||||
RxSwift: 8fc9f2de6275a9101d518444e00bf32f1a42caac
|
||||
|
||||
PODFILE CHECKSUM: e59f622df37d0fe135432c1ccda243973c311def
|
||||
|
||||
|
2554
Pods/Pods.xcodeproj/project.pbxproj
generated
2554
Pods/Pods.xcodeproj/project.pbxproj
generated
File diff suppressed because it is too large
Load Diff
24
Pods/RxCocoa/Platform/DataStructures/Bag.swift
generated
24
Pods/RxCocoa/Platform/DataStructures/Bag.swift
generated
@ -6,7 +6,6 @@
|
||||
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Swift
|
||||
|
||||
let arrayDictionaryMaxSize = 30
|
||||
@ -44,6 +43,9 @@ struct Bag<T> : CustomDebugStringConvertible {
|
||||
var _key0: BagKey? = nil
|
||||
var _value0: T? = nil
|
||||
|
||||
// then fill "array dictionary"
|
||||
var _pairs = ContiguousArray<Entry>()
|
||||
|
||||
// last is sparse dictionary
|
||||
var _dictionary: [BagKey : T]? = nil
|
||||
|
||||
@ -77,6 +79,11 @@ struct Bag<T> : CustomDebugStringConvertible {
|
||||
return key
|
||||
}
|
||||
|
||||
if _pairs.count < arrayDictionaryMaxSize {
|
||||
_pairs.append(key: key, value: element)
|
||||
return key
|
||||
}
|
||||
|
||||
if _dictionary == nil {
|
||||
_dictionary = [:]
|
||||
}
|
||||
@ -89,7 +96,7 @@ struct Bag<T> : CustomDebugStringConvertible {
|
||||
/// - returns: Number of elements in bag.
|
||||
var count: Int {
|
||||
let dictionaryCount: Int = _dictionary?.count ?? 0
|
||||
return (_value0 != nil ? 1 : 0) + dictionaryCount
|
||||
return (_value0 != nil ? 1 : 0) + _pairs.count + dictionaryCount
|
||||
}
|
||||
|
||||
/// Removes all elements from bag and clears capacity.
|
||||
@ -97,6 +104,7 @@ struct Bag<T> : CustomDebugStringConvertible {
|
||||
_key0 = nil
|
||||
_value0 = nil
|
||||
|
||||
_pairs.removeAll(keepingCapacity: false)
|
||||
_dictionary?.removeAll(keepingCapacity: false)
|
||||
}
|
||||
|
||||
@ -118,6 +126,14 @@ struct Bag<T> : CustomDebugStringConvertible {
|
||||
return existingObject
|
||||
}
|
||||
|
||||
for i in 0 ..< _pairs.count {
|
||||
if _pairs[i].key == key {
|
||||
let value = _pairs[i].value
|
||||
_pairs.remove(at: i)
|
||||
return value
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
}
|
||||
@ -148,6 +164,10 @@ extension Bag {
|
||||
action(value0)
|
||||
}
|
||||
|
||||
for i in 0 ..< _pairs.count {
|
||||
action(_pairs[i].value)
|
||||
}
|
||||
|
||||
if dictionary?.count ?? 0 > 0 {
|
||||
for element in dictionary!.values {
|
||||
action(element)
|
||||
|
@ -6,8 +6,6 @@
|
||||
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/// Sequence that repeats `repeatedValue` infinite number of times.
|
||||
struct InfiniteSequence<E> : Sequence {
|
||||
typealias Element = E
|
||||
|
@ -6,8 +6,6 @@
|
||||
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
struct PriorityQueue<Element> {
|
||||
private let _hasHigherPriority: (Element, Element) -> Bool
|
||||
private let _isEqual: (Element, Element) -> Bool
|
||||
|
2
Pods/RxCocoa/Platform/DataStructures/Queue.swift
generated
2
Pods/RxCocoa/Platform/DataStructures/Queue.swift
generated
@ -6,8 +6,6 @@
|
||||
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/**
|
||||
Data structure that represents queue.
|
||||
|
||||
|
@ -6,7 +6,6 @@
|
||||
// Copyright © 2016 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Dispatch
|
||||
|
||||
extension DispatchQueue {
|
||||
|
23
Pods/RxCocoa/Platform/Platform.Darwin.swift
generated
23
Pods/RxCocoa/Platform/Platform.Darwin.swift
generated
@ -9,17 +9,34 @@
|
||||
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
|
||||
|
||||
import Darwin
|
||||
import Foundation
|
||||
import class Foundation.Thread
|
||||
import func Foundation.OSAtomicCompareAndSwap32Barrier
|
||||
import func Foundation.OSAtomicIncrement32Barrier
|
||||
import func Foundation.OSAtomicDecrement32Barrier
|
||||
import protocol Foundation.NSCopying
|
||||
|
||||
typealias AtomicInt = Int32
|
||||
|
||||
fileprivate func castToUInt32Pointer(_ pointer: UnsafeMutablePointer<Int32>) -> UnsafeMutablePointer<UInt32> {
|
||||
let raw = UnsafeMutableRawPointer(pointer)
|
||||
return raw.assumingMemoryBound(to: UInt32.self)
|
||||
}
|
||||
|
||||
let AtomicCompareAndSwap = OSAtomicCompareAndSwap32Barrier
|
||||
let AtomicIncrement = OSAtomicIncrement32Barrier
|
||||
let AtomicDecrement = OSAtomicDecrement32Barrier
|
||||
func AtomicOr(_ mask: UInt32, _ theValue : UnsafeMutablePointer<Int32>) -> Int32 {
|
||||
return OSAtomicOr32OrigBarrier(mask, castToUInt32Pointer(theValue))
|
||||
}
|
||||
func AtomicFlagSet(_ mask: UInt32, _ theValue : UnsafeMutablePointer<Int32>) -> Bool {
|
||||
// just used to create a barrier
|
||||
OSAtomicXor32OrigBarrier(0, castToUInt32Pointer(theValue))
|
||||
return (theValue.pointee & Int32(mask)) != 0
|
||||
}
|
||||
|
||||
extension Thread {
|
||||
|
||||
static func setThreadLocalStorageValue<T: AnyObject>(_ value: T?, forKey key: String
|
||||
static func setThreadLocalStorageValue<T: AnyObject>(_ value: T?, forKey key: NSCopying
|
||||
) {
|
||||
let currentThread = Thread.current
|
||||
let threadDictionary = currentThread.threadDictionary
|
||||
@ -32,7 +49,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
static func getThreadLocalStorageValueForKey<T>(_ key: String) -> T? {
|
||||
static func getThreadLocalStorageValueForKey<T>(_ key: NSCopying) -> T? {
|
||||
let currentThread = Thread.current
|
||||
let threadDictionary = currentThread.threadDictionary
|
||||
|
||||
|
20
Pods/RxCocoa/Platform/Platform.Linux.swift
generated
20
Pods/RxCocoa/Platform/Platform.Linux.swift
generated
@ -7,20 +7,16 @@
|
||||
//
|
||||
|
||||
#if os(Linux)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// This is not the greatest API in the world, this is just a tribute.
|
||||
// !!! Proof of concept until libdispatch becomes operational. !!!
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
import Foundation
|
||||
import XCTest
|
||||
import Glibc
|
||||
import SwiftShims
|
||||
import class Foundation.Thread
|
||||
|
||||
final class AtomicInt {
|
||||
typealias IntegerLiteralType = Int
|
||||
fileprivate var value: Int32 = 0
|
||||
fileprivate var _lock = NSRecursiveLock()
|
||||
fileprivate var _lock = RecursiveLock()
|
||||
|
||||
func lock() {
|
||||
_lock.lock()
|
||||
@ -48,6 +44,18 @@
|
||||
return lhs.value == rhs
|
||||
}
|
||||
|
||||
func AtomicFlagSet(_ mask: UInt32, _ atomic: inout AtomicInt) -> Bool {
|
||||
atomic.lock(); defer { atomic.unlock() }
|
||||
return (atomic.value & Int32(mask)) != 0
|
||||
}
|
||||
|
||||
func AtomicOr(_ mask: UInt32, _ atomic: inout AtomicInt) -> Int32 {
|
||||
atomic.lock(); defer { atomic.unlock() }
|
||||
let value = atomic.value
|
||||
atomic.value |= Int32(mask)
|
||||
return value
|
||||
}
|
||||
|
||||
func AtomicIncrement(_ atomic: inout AtomicInt) -> Int32 {
|
||||
atomic.lock(); defer { atomic.unlock() }
|
||||
atomic.value += 1
|
||||
|
34
Pods/RxCocoa/Platform/RecursiveLock.swift
generated
Normal file
34
Pods/RxCocoa/Platform/RecursiveLock.swift
generated
Normal file
@ -0,0 +1,34 @@
|
||||
//
|
||||
// RecursiveLock.swift
|
||||
// Platform
|
||||
//
|
||||
// Created by Krunoslav Zaher on 12/18/16.
|
||||
// Copyright © 2016 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
#if TRACE_RESOURCES
|
||||
class RecursiveLock: NSRecursiveLock {
|
||||
override init() {
|
||||
_ = Resources.incrementTotal()
|
||||
super.init()
|
||||
}
|
||||
|
||||
override func lock() {
|
||||
super.lock()
|
||||
_ = Resources.incrementTotal()
|
||||
}
|
||||
|
||||
override func unlock() {
|
||||
super.unlock()
|
||||
_ = Resources.decrementTotal()
|
||||
}
|
||||
|
||||
deinit {
|
||||
_ = Resources.decrementTotal()
|
||||
}
|
||||
}
|
||||
#else
|
||||
typealias RecursiveLock = NSRecursiveLock
|
||||
#endif
|
16
Pods/RxCocoa/README.md
generated
16
Pods/RxCocoa/README.md
generated
@ -45,7 +45,7 @@ KVO observing, async operations and streams are all unified under [abstraction o
|
||||
|
||||
###### ... interact
|
||||
|
||||
* All of this is great, but it would be nice to talk with other people using RxSwift and exchange experiences. <br />[](http://slack.rxswift.org) [Join Slack Channel](http://rxswift-slack.herokuapp.com)
|
||||
* All of this is great, but it would be nice to talk with other people using RxSwift and exchange experiences. <br />[](http://rxswift-slack.herokuapp.com/) [Join Slack Channel](http://rxswift-slack.herokuapp.com)
|
||||
* Report a problem using the library. [Open an Issue With Bug Template](.github/ISSUE_TEMPLATE.md)
|
||||
* Request a new feature. [Open an Issue With Feature Request Template](Documentation/NewFeatureRequestTemplate.md)
|
||||
|
||||
@ -102,7 +102,7 @@ searchResults
|
||||
cell.textLabel?.text = repository.name
|
||||
cell.detailTextLabel?.text = repository.url
|
||||
}
|
||||
.addDisposableTo(disposeBag)</pre></div></td>
|
||||
.disposed(by: disposeBag)</pre></div></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@ -126,7 +126,7 @@ Open Rx.xcworkspace, choose `RxExample` and hit run. This method will build ever
|
||||
|
||||
**Tested with `pod --version`: `1.1.1`**
|
||||
|
||||
```
|
||||
```ruby
|
||||
# Podfile
|
||||
use_frameworks!
|
||||
|
||||
@ -144,7 +144,7 @@ end
|
||||
|
||||
Replace `YOUR_TARGET_NAME` and then, in the `Podfile` directory, type:
|
||||
|
||||
```
|
||||
```bash
|
||||
$ pod install
|
||||
```
|
||||
|
||||
@ -158,7 +158,7 @@ Add this to `Cartfile`
|
||||
github "ReactiveX/RxSwift" ~> 3.0
|
||||
```
|
||||
|
||||
```
|
||||
```bash
|
||||
$ carthage update
|
||||
```
|
||||
|
||||
@ -168,7 +168,7 @@ $ carthage update
|
||||
|
||||
Create a `Package.swift` file.
|
||||
|
||||
```
|
||||
```swift
|
||||
import PackageDescription
|
||||
|
||||
let package = Package(
|
||||
@ -180,7 +180,7 @@ let package = Package(
|
||||
)
|
||||
```
|
||||
|
||||
```
|
||||
```bash
|
||||
$ swift build
|
||||
```
|
||||
|
||||
@ -188,7 +188,7 @@ $ swift build
|
||||
|
||||
* Add RxSwift as a submodule
|
||||
|
||||
```
|
||||
```bash
|
||||
$ git submodule add git@github.com:ReactiveX/RxSwift.git
|
||||
```
|
||||
|
||||
|
@ -6,7 +6,6 @@
|
||||
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
#if !RX_NO_MODULE
|
||||
import RxSwift
|
||||
#endif
|
||||
|
@ -6,7 +6,6 @@
|
||||
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
#if !RX_NO_MODULE
|
||||
import RxSwift
|
||||
#endif
|
||||
|
@ -6,7 +6,6 @@
|
||||
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
#if !RX_NO_MODULE
|
||||
import RxSwift
|
||||
#endif
|
||||
|
@ -6,7 +6,6 @@
|
||||
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
#if !RX_NO_MODULE
|
||||
import RxSwift
|
||||
#endif
|
||||
|
@ -6,7 +6,6 @@
|
||||
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
#if !RX_NO_MODULE
|
||||
import RxSwift
|
||||
#endif
|
||||
|
@ -6,7 +6,6 @@
|
||||
// Copyright © 2016 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
#if !RX_NO_MODULE
|
||||
import RxSwift
|
||||
#endif
|
||||
@ -72,6 +71,8 @@ public func driveOnScheduler(_ scheduler: SchedulerType, action: () -> ()) {
|
||||
|
||||
#if os(Linux)
|
||||
import Glibc
|
||||
#else
|
||||
import func Foundation.arc4random
|
||||
#endif
|
||||
|
||||
func _forceCompilerToStopDoingInsaneOptimizationsThatBreakCode(_ scheduler: SchedulerType) {
|
||||
|
@ -6,7 +6,6 @@
|
||||
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
#if !RX_NO_MODULE
|
||||
import RxSwift
|
||||
#endif
|
||||
|
@ -6,7 +6,6 @@
|
||||
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
#if !RX_NO_MODULE
|
||||
import RxSwift
|
||||
#endif
|
||||
|
@ -6,7 +6,6 @@
|
||||
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
#if !RX_NO_MODULE
|
||||
import RxSwift
|
||||
#endif
|
||||
|
@ -7,7 +7,6 @@
|
||||
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
#if !RX_NO_MODULE
|
||||
import RxSwift
|
||||
#endif
|
||||
|
@ -6,7 +6,6 @@
|
||||
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
#if !RX_NO_MODULE
|
||||
import RxSwift
|
||||
#endif
|
||||
@ -217,8 +216,51 @@ extension SharedSequenceConvertibleType {
|
||||
}
|
||||
|
||||
// MARK: merge
|
||||
extension SharedSequenceConvertibleType where E : SharedSequenceConvertibleType, E.SharingStrategy == SharingStrategy {
|
||||
extension SharedSequenceConvertibleType {
|
||||
/**
|
||||
Merges elements from all observable sequences from collection into a single observable sequence.
|
||||
|
||||
- seealso: [merge operator on reactivex.io](http://reactivex.io/documentation/operators/merge.html)
|
||||
|
||||
- parameter sources: Collection of observable sequences to merge.
|
||||
- returns: The observable sequence that merges the elements of the observable sequences.
|
||||
*/
|
||||
public static func merge<C: Collection>(_ sources: C) -> SharedSequence<SharingStrategy, E>
|
||||
where C.Iterator.Element == SharedSequence<SharingStrategy, E> {
|
||||
let source = Observable.merge(sources.map { $0.asObservable() })
|
||||
return SharedSequence<SharingStrategy, E>(source)
|
||||
}
|
||||
|
||||
/**
|
||||
Merges elements from all observable sequences from array into a single observable sequence.
|
||||
|
||||
- seealso: [merge operator on reactivex.io](http://reactivex.io/documentation/operators/merge.html)
|
||||
|
||||
- parameter sources: Array of observable sequences to merge.
|
||||
- returns: The observable sequence that merges the elements of the observable sequences.
|
||||
*/
|
||||
public static func merge(_ sources: [SharedSequence<SharingStrategy, E>]) -> SharedSequence<SharingStrategy, E> {
|
||||
let source = Observable.merge(sources.map { $0.asObservable() })
|
||||
return SharedSequence<SharingStrategy, E>(source)
|
||||
}
|
||||
|
||||
/**
|
||||
Merges elements from all observable sequences into a single observable sequence.
|
||||
|
||||
- seealso: [merge operator on reactivex.io](http://reactivex.io/documentation/operators/merge.html)
|
||||
|
||||
- parameter sources: Collection of observable sequences to merge.
|
||||
- returns: The observable sequence that merges the elements of the observable sequences.
|
||||
*/
|
||||
public static func merge(_ sources: SharedSequence<SharingStrategy, E>...) -> SharedSequence<SharingStrategy, E> {
|
||||
let source = Observable.merge(sources.map { $0.asObservable() })
|
||||
return SharedSequence<SharingStrategy, E>(source)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: merge
|
||||
extension SharedSequenceConvertibleType where E : SharedSequenceConvertibleType, E.SharingStrategy == SharingStrategy {
|
||||
/**
|
||||
Merges elements from all observable sequences in the given enumerable sequence into a single observable sequence.
|
||||
|
||||
|
@ -6,7 +6,6 @@
|
||||
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
#if !RX_NO_MODULE
|
||||
import RxSwift
|
||||
#endif
|
||||
@ -109,7 +108,7 @@ extension SharedSequence {
|
||||
- returns: An observable sequence with no elements.
|
||||
*/
|
||||
public static func empty() -> SharedSequence<S, E> {
|
||||
return SharedSequence(Observable.empty().subscribeOn(S.scheduler))
|
||||
return SharedSequence(raw: Observable.empty().subscribeOn(S.scheduler))
|
||||
}
|
||||
|
||||
/**
|
||||
@ -118,7 +117,7 @@ extension SharedSequence {
|
||||
- returns: An observable sequence whose observers will never get called.
|
||||
*/
|
||||
public static func never() -> SharedSequence<S, E> {
|
||||
return SharedSequence(Observable.never())
|
||||
return SharedSequence(raw: Observable.never())
|
||||
}
|
||||
|
||||
/**
|
||||
@ -128,7 +127,7 @@ extension SharedSequence {
|
||||
- returns: An observable sequence containing the single specified element.
|
||||
*/
|
||||
public static func just(_ element: E) -> SharedSequence<S, E> {
|
||||
return SharedSequence(Observable.just(element).subscribeOn(S.scheduler))
|
||||
return SharedSequence(raw: Observable.just(element).subscribeOn(S.scheduler))
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -6,7 +6,6 @@
|
||||
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
#if !RX_NO_MODULE
|
||||
import RxSwift
|
||||
#endif
|
||||
|
@ -6,7 +6,6 @@
|
||||
// Copyright © 2016 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Dispatch
|
||||
#if !RX_NO_MODULE
|
||||
import RxSwift
|
||||
@ -22,7 +21,7 @@ Observer that enforces interface binding rules:
|
||||
In case event binding is attempted from non main dispatch queue, event binding will be dispatched async to main dispatch
|
||||
queue.
|
||||
*/
|
||||
public class UIBindingObserver<UIElementType, Value> : ObserverType where UIElementType: AnyObject {
|
||||
public final class UIBindingObserver<UIElementType, Value> : ObserverType where UIElementType: AnyObject {
|
||||
public typealias E = Value
|
||||
|
||||
weak var UIElement: UIElementType?
|
||||
|
3
Pods/RxCocoa/RxCocoa/Common/ControlTarget.swift
generated
3
Pods/RxCocoa/RxCocoa/Common/ControlTarget.swift
generated
@ -8,7 +8,6 @@
|
||||
|
||||
#if os(iOS) || os(tvOS) || os(macOS)
|
||||
|
||||
import Foundation
|
||||
#if !RX_NO_MODULE
|
||||
import RxSwift
|
||||
#endif
|
||||
@ -25,7 +24,7 @@ import RxSwift
|
||||
#endif
|
||||
|
||||
// This should be only used from `MainScheduler`
|
||||
class ControlTarget: RxTarget {
|
||||
final class ControlTarget: RxTarget {
|
||||
typealias Callback = (Control) -> Void
|
||||
|
||||
let selector: Selector = #selector(ControlTarget.eventHandler(_:))
|
||||
|
99
Pods/RxCocoa/RxCocoa/Common/DelegateProxy.swift
generated
99
Pods/RxCocoa/RxCocoa/Common/DelegateProxy.swift
generated
@ -8,7 +8,6 @@
|
||||
|
||||
#if !os(Linux)
|
||||
|
||||
import Foundation
|
||||
#if !RX_NO_MODULE
|
||||
import RxSwift
|
||||
#if SWIFT_PACKAGE && !os(Linux)
|
||||
@ -16,16 +15,16 @@ import Foundation
|
||||
#endif
|
||||
#endif
|
||||
|
||||
var delegateAssociatedTag: UInt8 = 0
|
||||
var dataSourceAssociatedTag: UInt8 = 0
|
||||
var delegateAssociatedTag: UnsafeRawPointer = UnsafeRawPointer(UnsafeMutablePointer<UInt8>.allocate(capacity: 1))
|
||||
var dataSourceAssociatedTag: UnsafeRawPointer = UnsafeRawPointer(UnsafeMutablePointer<UInt8>.allocate(capacity: 1))
|
||||
|
||||
/// Base class for `DelegateProxyType` protocol.
|
||||
///
|
||||
/// This implementation is not thread safe and can be used only from one thread (Main thread).
|
||||
open class DelegateProxy : _RXDelegateProxy {
|
||||
|
||||
private var sentMessageForSelector = [Selector: PublishSubject<[Any]>]()
|
||||
private var methodInvokedForSelector = [Selector: PublishSubject<[Any]>]()
|
||||
private var sentMessageForSelector = [Selector: MessageDispatcher]()
|
||||
private var methodInvokedForSelector = [Selector: MessageDispatcher]()
|
||||
|
||||
/// Parent object associated with delegate proxy.
|
||||
weak private(set) var parentObject: AnyObject?
|
||||
@ -86,17 +85,18 @@ open class DelegateProxy : _RXDelegateProxy {
|
||||
- returns: Observable sequence of arguments passed to `selector` method.
|
||||
*/
|
||||
open func sentMessage(_ selector: Selector) -> Observable<[Any]> {
|
||||
MainScheduler.ensureExecutingOnScheduler()
|
||||
checkSelectorIsObservable(selector)
|
||||
|
||||
let subject = sentMessageForSelector[selector]
|
||||
|
||||
if let subject = subject {
|
||||
return subject
|
||||
return subject.asObservable()
|
||||
}
|
||||
else {
|
||||
let subject = PublishSubject<[Any]>()
|
||||
let subject = MessageDispatcher(delegateProxy: self)
|
||||
sentMessageForSelector[selector] = subject
|
||||
return subject
|
||||
return subject.asObservable()
|
||||
}
|
||||
}
|
||||
|
||||
@ -143,17 +143,18 @@ open class DelegateProxy : _RXDelegateProxy {
|
||||
- returns: Observable sequence of arguments passed to `selector` method.
|
||||
*/
|
||||
open func methodInvoked(_ selector: Selector) -> Observable<[Any]> {
|
||||
MainScheduler.ensureExecutingOnScheduler()
|
||||
checkSelectorIsObservable(selector)
|
||||
|
||||
let subject = methodInvokedForSelector[selector]
|
||||
|
||||
if let subject = subject {
|
||||
return subject
|
||||
return subject.asObservable()
|
||||
}
|
||||
else {
|
||||
let subject = PublishSubject<[Any]>()
|
||||
let subject = MessageDispatcher(delegateProxy: self)
|
||||
methodInvokedForSelector[selector] = subject
|
||||
return subject
|
||||
return subject.asObservable()
|
||||
}
|
||||
}
|
||||
|
||||
@ -162,15 +163,10 @@ open class DelegateProxy : _RXDelegateProxy {
|
||||
|
||||
if hasWiredImplementation(for: selector) {
|
||||
print("Delegate proxy is already implementing `\(selector)`, a more performant way of registering might exist.")
|
||||
return
|
||||
}
|
||||
|
||||
// It's important to see if super class reponds to selector and not self,
|
||||
// because super class (_RxDelegateProxy) returns all methods delegate proxy
|
||||
// can respond to.
|
||||
// Because of https://github.com/ReactiveX/RxSwift/issues/907 , and possibly
|
||||
// some other reasons, subclasses could overrride `responds(to:)`, but it shouldn't matter
|
||||
// for this case.
|
||||
if !super.responds(to: selector) {
|
||||
guard (self.forwardToDelegate()?.responds(to: selector) ?? false) || voidDelegateMethodsContain(selector) else {
|
||||
rxFatalError("This class doesn't respond to selector \(selector)")
|
||||
}
|
||||
}
|
||||
@ -189,7 +185,7 @@ open class DelegateProxy : _RXDelegateProxy {
|
||||
///
|
||||
/// - returns: Associated object tag.
|
||||
open class func delegateAssociatedObjectTag() -> UnsafeRawPointer {
|
||||
return _pointer(&delegateAssociatedTag)
|
||||
return delegateAssociatedTag
|
||||
}
|
||||
|
||||
/// Initializes new instance of delegate proxy.
|
||||
@ -224,7 +220,11 @@ open class DelegateProxy : _RXDelegateProxy {
|
||||
/// - parameter forwardToDelegate: Reference of delegate that receives all messages through `self`.
|
||||
/// - parameter retainDelegate: Should `self` retain `forwardToDelegate`.
|
||||
open func setForwardToDelegate(_ delegate: AnyObject?, retainDelegate: Bool) {
|
||||
#if DEBUG // 4.0 all configurations
|
||||
MainScheduler.ensureExecutingOnScheduler()
|
||||
#endif
|
||||
self._setForward(toDelegate: delegate, retainDelegate: retainDelegate)
|
||||
self.reset()
|
||||
}
|
||||
|
||||
/// Returns reference of normal delegate that receives all forwarded messages
|
||||
@ -235,6 +235,35 @@ open class DelegateProxy : _RXDelegateProxy {
|
||||
return self._forwardToDelegate
|
||||
}
|
||||
|
||||
private func hasObservers(selector: Selector) -> Bool {
|
||||
return (sentMessageForSelector[selector]?.hasObservers ?? false)
|
||||
|| (methodInvokedForSelector[selector]?.hasObservers ?? false)
|
||||
}
|
||||
|
||||
override open func responds(to aSelector: Selector!) -> Bool {
|
||||
return super.responds(to: aSelector)
|
||||
|| (self._forwardToDelegate?.responds(to: aSelector) ?? false)
|
||||
|| (self.voidDelegateMethodsContain(aSelector) && self.hasObservers(selector: aSelector))
|
||||
}
|
||||
|
||||
internal func reset() {
|
||||
guard let delegateProxySelf = self as? DelegateProxyType else {
|
||||
rxFatalErrorInDebug("\(self) doesn't implement delegate proxy type.")
|
||||
return
|
||||
}
|
||||
|
||||
guard let parentObject = self.parentObject else { return }
|
||||
|
||||
let selfType = type(of: delegateProxySelf)
|
||||
|
||||
let maybeCurrentDelegate = selfType.currentDelegateFor(parentObject)
|
||||
|
||||
if maybeCurrentDelegate === self {
|
||||
selfType.setCurrentDelegate(nil, toObject: parentObject)
|
||||
selfType.setCurrentDelegate(self, toObject: parentObject)
|
||||
}
|
||||
}
|
||||
|
||||
deinit {
|
||||
for v in sentMessageForSelector.values {
|
||||
v.on(.completed)
|
||||
@ -246,13 +275,37 @@ open class DelegateProxy : _RXDelegateProxy {
|
||||
_ = Resources.decrementTotal()
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: Pointer
|
||||
fileprivate let mainScheduler = MainScheduler()
|
||||
|
||||
class func _pointer(_ p: UnsafeRawPointer) -> UnsafeRawPointer {
|
||||
return p
|
||||
fileprivate final class MessageDispatcher {
|
||||
private let dispatcher: PublishSubject<[Any]>
|
||||
private let result: Observable<[Any]>
|
||||
|
||||
init(delegateProxy _delegateProxy: DelegateProxy) {
|
||||
weak var weakDelegateProxy = _delegateProxy
|
||||
|
||||
let dispatcher = PublishSubject<[Any]>()
|
||||
self.dispatcher = dispatcher
|
||||
|
||||
self.result = dispatcher
|
||||
.do(onSubscribed: { weakDelegateProxy?.reset() }, onDispose: { weakDelegateProxy?.reset() })
|
||||
.share()
|
||||
.subscribeOn(mainScheduler)
|
||||
}
|
||||
|
||||
var on: (Event<[Any]>) -> () {
|
||||
return self.dispatcher.on
|
||||
}
|
||||
|
||||
var hasObservers: Bool {
|
||||
return self.dispatcher.hasObservers
|
||||
}
|
||||
|
||||
func asObservable() -> Observable<[Any]> {
|
||||
return self.result
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
12
Pods/RxCocoa/RxCocoa/Common/DelegateProxyType.swift
generated
12
Pods/RxCocoa/RxCocoa/Common/DelegateProxyType.swift
generated
@ -8,7 +8,6 @@
|
||||
|
||||
#if !os(Linux)
|
||||
|
||||
import Foundation
|
||||
#if !RX_NO_MODULE
|
||||
import RxSwift
|
||||
#endif
|
||||
@ -201,19 +200,12 @@ extension DelegateProxyType {
|
||||
|
||||
proxy.setForwardToDelegate(forwardDelegate, retainDelegate: retainDelegate)
|
||||
|
||||
// refresh properties after delegate is set
|
||||
// some views like UITableView cache `respondsToSelector`
|
||||
Self.setCurrentDelegate(nil, toObject: object)
|
||||
Self.setCurrentDelegate(proxy, toObject: object)
|
||||
|
||||
assert(proxy.forwardToDelegate() === forwardDelegate, "Setting of delegate failed:\ncurrent:\n\(proxy.forwardToDelegate())\nexpected:\n\(forwardDelegate)")
|
||||
|
||||
return Disposables.create {
|
||||
MainScheduler.ensureExecutingOnScheduler()
|
||||
|
||||
let delegate: AnyObject? = weakForwardDelegate
|
||||
|
||||
assert(delegate == nil || proxy.forwardToDelegate() === delegate, "Delegate was changed from time it was first set. Current \(proxy.forwardToDelegate()), and it should have been \(proxy)")
|
||||
assert(delegate == nil || proxy.forwardToDelegate() === delegate, "Delegate was changed from time it was first set. Current \(String(describing: proxy.forwardToDelegate())), and it should have been \(proxy)")
|
||||
|
||||
proxy.setForwardToDelegate(nil, retainDelegate: retainDelegate)
|
||||
}
|
||||
@ -243,7 +235,7 @@ extension DelegateProxyType {
|
||||
.subscribe { [weak object] (event: Event<E>) in
|
||||
|
||||
if let object = object {
|
||||
assert(proxy === P.currentDelegateFor(object), "Proxy changed from the time it was first set.\nOriginal: \(proxy)\nExisting: \(P.currentDelegateFor(object))")
|
||||
assert(proxy === P.currentDelegateFor(object), "Proxy changed from the time it was first set.\nOriginal: \(proxy)\nExisting: \(String(describing: P.currentDelegateFor(object)))")
|
||||
}
|
||||
|
||||
binding(proxy, event)
|
||||
|
@ -8,8 +8,6 @@
|
||||
|
||||
#if !os(Linux)
|
||||
|
||||
import Foundation
|
||||
|
||||
#if os(macOS)
|
||||
import Cocoa
|
||||
#else
|
||||
|
@ -6,7 +6,6 @@
|
||||
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
#if !RX_NO_MODULE
|
||||
import RxSwift
|
||||
#endif
|
||||
|
@ -6,7 +6,6 @@
|
||||
// Copyright © 2016 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
#if !RX_NO_MODULE
|
||||
#if SWIFT_PACKAGE && !DISABLE_SWIZZLING && !os(Linux)
|
||||
import RxCocoaRuntime
|
||||
|
3
Pods/RxCocoa/RxCocoa/Common/RxTarget.swift
generated
3
Pods/RxCocoa/RxCocoa/Common/RxTarget.swift
generated
@ -6,7 +6,8 @@
|
||||
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import class Foundation.NSObject
|
||||
|
||||
#if !RX_NO_MODULE
|
||||
import RxSwift
|
||||
#endif
|
||||
|
@ -6,7 +6,7 @@
|
||||
// Copyright © 2016 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import struct Foundation.IndexPath
|
||||
|
||||
/// Data source with access to underlying sectioned model.
|
||||
public protocol SectionedViewDataSourceType {
|
||||
|
2
Pods/RxCocoa/RxCocoa/Common/TextInput.swift
generated
2
Pods/RxCocoa/RxCocoa/Common/TextInput.swift
generated
@ -6,8 +6,6 @@
|
||||
// Copyright © 2016 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
#if !RX_NO_MODULE
|
||||
import RxSwift
|
||||
#endif
|
||||
|
@ -8,11 +8,12 @@
|
||||
|
||||
#if !os(Linux)
|
||||
|
||||
import Foundation
|
||||
#if !RX_NO_MODULE
|
||||
import RxSwift
|
||||
#endif
|
||||
import CoreGraphics
|
||||
import CoreGraphics
|
||||
|
||||
import class Foundation.NSValue
|
||||
|
||||
#if arch(x86_64) || arch(arm64)
|
||||
let CGRectType = "{CGRect={CGPoint=dd}{CGSize=dd}}"
|
||||
|
@ -6,7 +6,7 @@
|
||||
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import class Foundation.NSNumber
|
||||
|
||||
extension Int : KVORepresentable {
|
||||
public typealias KVOType = NSNumber
|
||||
|
@ -6,8 +6,6 @@
|
||||
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/// Type that is KVO representable (KVO mechanism can be used to observe it).
|
||||
public protocol KVORepresentable {
|
||||
/// Associated KVO type.
|
||||
|
2
Pods/RxCocoa/RxCocoa/Foundation/Logging.swift
generated
2
Pods/RxCocoa/RxCocoa/Foundation/Logging.swift
generated
@ -6,7 +6,7 @@
|
||||
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import struct Foundation.URLRequest
|
||||
|
||||
/// Simple logging settings for RxCocoa library.
|
||||
public struct Logging {
|
||||
|
@ -312,7 +312,7 @@ extension Reactive where Base: AnyObject {
|
||||
#endif
|
||||
|
||||
|
||||
fileprivate class DeallocObservable {
|
||||
fileprivate final class DeallocObservable {
|
||||
let _subject = ReplaySubject<Void>.create(bufferSize:1)
|
||||
|
||||
init() {
|
||||
@ -335,7 +335,7 @@ fileprivate protocol KVOObservableProtocol {
|
||||
var options: NSKeyValueObservingOptions { get }
|
||||
}
|
||||
|
||||
fileprivate class KVOObserver
|
||||
fileprivate final class KVOObserver
|
||||
: _RXKVOObserver
|
||||
, Disposable {
|
||||
typealias Callback = (Any?) -> Void
|
||||
@ -363,7 +363,7 @@ fileprivate class KVOObserver
|
||||
}
|
||||
}
|
||||
|
||||
fileprivate class KVOObservable<Element>
|
||||
fileprivate final class KVOObservable<Element>
|
||||
: ObservableType
|
||||
, KVOObservableProtocol {
|
||||
typealias E = Element?
|
||||
|
@ -1,12 +1,14 @@
|
||||
//
|
||||
// NSNotificationCenter+Rx.swift
|
||||
// NotificationCenter+Rx.swift
|
||||
// RxCocoa
|
||||
//
|
||||
// Created by Krunoslav Zaher on 5/2/15.
|
||||
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import class Foundation.NotificationCenter
|
||||
import struct Foundation.Notification
|
||||
|
||||
#if !RX_NO_MODULE
|
||||
import RxSwift
|
||||
#endif
|
27
Pods/RxCocoa/RxCocoa/Foundation/URLSession+Rx.swift
generated
27
Pods/RxCocoa/RxCocoa/Foundation/URLSession+Rx.swift
generated
@ -6,7 +6,24 @@
|
||||
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import struct Foundation.URL
|
||||
import struct Foundation.URLRequest
|
||||
import struct Foundation.Data
|
||||
import struct Foundation.Date
|
||||
import struct Foundation.TimeInterval
|
||||
import class Foundation.HTTPURLResponse
|
||||
import class Foundation.URLSession
|
||||
import class Foundation.URLResponse
|
||||
import class Foundation.JSONSerialization
|
||||
import class Foundation.NSError
|
||||
import var Foundation.NSURLErrorCancelled
|
||||
import var Foundation.NSURLErrorDomain
|
||||
|
||||
#if os(Linux)
|
||||
// don't know why
|
||||
import Foundation
|
||||
#endif
|
||||
|
||||
#if !RX_NO_MODULE
|
||||
import RxSwift
|
||||
#endif
|
||||
@ -71,7 +88,7 @@ fileprivate func convertURLRequestToCurlCommand(_ request: URLRequest) -> String
|
||||
return returnValue
|
||||
}
|
||||
|
||||
fileprivate func convertResponseToString(_ data: Data!, _ response: URLResponse!, _ error: NSError!, _ interval: TimeInterval) -> String {
|
||||
fileprivate func convertResponseToString(_ response: URLResponse?, _ error: NSError?, _ interval: TimeInterval) -> String {
|
||||
let ms = Int(interval * 1000)
|
||||
|
||||
if let response = response as? HTTPURLResponse {
|
||||
@ -124,7 +141,7 @@ extension Reactive where Base: URLSession {
|
||||
if Logging.URLRequests(request) {
|
||||
let interval = Date().timeIntervalSince(d ?? Date())
|
||||
print(convertURLRequestToCurlCommand(request))
|
||||
print(convertResponseToString(data, response, error as NSError!, interval))
|
||||
print(convertResponseToString(response, error.map { $0 as NSError }, interval))
|
||||
}
|
||||
|
||||
guard let response = response, let data = data else {
|
||||
@ -141,9 +158,7 @@ extension Reactive where Base: URLSession {
|
||||
observer.on(.completed)
|
||||
}
|
||||
|
||||
|
||||
let t = task
|
||||
t.resume()
|
||||
task.resume()
|
||||
|
||||
return Disposables.create(with: task.cancel)
|
||||
}
|
||||
|
32
Pods/RxCocoa/RxCocoa/Runtime/_RXDelegateProxy.m
generated
32
Pods/RxCocoa/RxCocoa/Runtime/_RXDelegateProxy.m
generated
@ -18,11 +18,11 @@
|
||||
|
||||
@end
|
||||
|
||||
static NSMutableDictionary *forwardableSelectorsPerClass = nil;
|
||||
static NSMutableDictionary *voidSelectorsPerClass = nil;
|
||||
|
||||
@implementation _RXDelegateProxy
|
||||
|
||||
+(NSSet*)collectSelectorsForProtocol:(Protocol *)protocol {
|
||||
+(NSSet*)collectVoidSelectorsForProtocol:(Protocol *)protocol {
|
||||
NSMutableSet *selectors = [NSMutableSet set];
|
||||
|
||||
unsigned int protocolMethodCount = 0;
|
||||
@ -41,7 +41,7 @@ static NSMutableDictionary *forwardableSelectorsPerClass = nil;
|
||||
Protocol * __unsafe_unretained * pSubprotocols = protocol_copyProtocolList(protocol, &numberOfBaseProtocols);
|
||||
|
||||
for (unsigned int i = 0; i < numberOfBaseProtocols; ++i) {
|
||||
[selectors unionSet:[self collectSelectorsForProtocol:pSubprotocols[i]]];
|
||||
[selectors unionSet:[self collectVoidSelectorsForProtocol:pSubprotocols[i]]];
|
||||
}
|
||||
|
||||
free(pSubprotocols);
|
||||
@ -51,11 +51,11 @@ static NSMutableDictionary *forwardableSelectorsPerClass = nil;
|
||||
|
||||
+(void)initialize {
|
||||
@synchronized (_RXDelegateProxy.class) {
|
||||
if (forwardableSelectorsPerClass == nil) {
|
||||
forwardableSelectorsPerClass = [[NSMutableDictionary alloc] init];
|
||||
if (voidSelectorsPerClass == nil) {
|
||||
voidSelectorsPerClass = [[NSMutableDictionary alloc] init];
|
||||
}
|
||||
|
||||
NSMutableSet *allowedSelectors = [NSMutableSet set];
|
||||
NSMutableSet *voidSelectors = [NSMutableSet set];
|
||||
|
||||
#define CLASS_HIERARCHY_MAX_DEPTH 100
|
||||
|
||||
@ -70,8 +70,8 @@ static NSMutableDictionary *forwardableSelectorsPerClass = nil;
|
||||
Protocol *__unsafe_unretained *pProtocols = class_copyProtocolList(targetClass, &count);
|
||||
|
||||
for (unsigned int i = 0; i < count; i++) {
|
||||
NSSet *selectorsForProtocol = [self collectSelectorsForProtocol:pProtocols[i]];
|
||||
[allowedSelectors unionSet:selectorsForProtocol];
|
||||
NSSet *selectorsForProtocol = [self collectVoidSelectorsForProtocol:pProtocols[i]];
|
||||
[voidSelectors unionSet:selectorsForProtocol];
|
||||
}
|
||||
|
||||
free(pProtocols);
|
||||
@ -84,7 +84,7 @@ static NSMutableDictionary *forwardableSelectorsPerClass = nil;
|
||||
#endif
|
||||
}
|
||||
|
||||
forwardableSelectorsPerClass[CLASS_VALUE(self)] = allowedSelectors;
|
||||
voidSelectorsPerClass[CLASS_VALUE(self)] = voidSelectors;
|
||||
}
|
||||
}
|
||||
|
||||
@ -106,20 +106,14 @@ static NSMutableDictionary *forwardableSelectorsPerClass = nil;
|
||||
return [super respondsToSelector:selector];
|
||||
}
|
||||
|
||||
-(BOOL)canRespondToSelector:(SEL)selector {
|
||||
-(BOOL)voidDelegateMethodsContain:(SEL)selector {
|
||||
@synchronized(_RXDelegateProxy.class) {
|
||||
NSSet *allowedMethods = forwardableSelectorsPerClass[CLASS_VALUE(self.class)];
|
||||
NSAssert(allowedMethods != nil, @"Set of allowed methods not initialized");
|
||||
return [allowedMethods containsObject:SEL_VALUE(selector)];
|
||||
NSSet *voidSelectors = voidSelectorsPerClass[CLASS_VALUE(self.class)];
|
||||
NSAssert(voidSelectors != nil, @"Set of allowed methods not initialized");
|
||||
return [voidSelectors containsObject:SEL_VALUE(selector)];
|
||||
}
|
||||
}
|
||||
|
||||
-(BOOL)respondsToSelector:(SEL)aSelector {
|
||||
return [super respondsToSelector:aSelector]
|
||||
|| [self._forwardToDelegate respondsToSelector:aSelector]
|
||||
|| [self canRespondToSelector:aSelector];
|
||||
}
|
||||
|
||||
-(void)forwardInvocation:(NSInvocation *)anInvocation {
|
||||
BOOL isVoid = RX_is_method_signature_void(anInvocation.methodSignature);
|
||||
NSArray *arguments = nil;
|
||||
|
@ -17,6 +17,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
-(void)_setForwardToDelegate:(id __nullable)forwardToDelegate retainDelegate:(BOOL)retainDelegate;
|
||||
|
||||
-(BOOL)hasWiredImplementationForSelector:(SEL)selector;
|
||||
-(BOOL)voidDelegateMethodsContain:(SEL)selector;
|
||||
|
||||
-(void)_sentMessage:(SEL)selector withArguments:(NSArray*)arguments;
|
||||
-(void)_methodInvoked:(SEL)selector withArguments:(NSArray*)arguments;
|
||||
|
23
Pods/RxCocoa/RxCocoa/RxCocoa.swift
generated
23
Pods/RxCocoa/RxCocoa/RxCocoa.swift
generated
@ -6,7 +6,8 @@
|
||||
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import class Foundation.NSNull
|
||||
|
||||
#if !RX_NO_MODULE
|
||||
import RxSwift
|
||||
#endif
|
||||
@ -72,14 +73,22 @@ func bindingErrorToInterface(_ error: Swift.Error) {
|
||||
#endif
|
||||
}
|
||||
|
||||
// MARK: Abstract methods
|
||||
|
||||
func rxAbstractMethodWithMessage(_ message: String) -> Swift.Never {
|
||||
rxFatalError(message)
|
||||
/// Swift does not implement abstract methods. This method is used as a runtime check to ensure that methods which intended to be abstract (i.e., they should be implemented in subclasses) are not called directly on the superclass.
|
||||
func rxAbstractMethod(message: String = "Abstract method", file: StaticString = #file, line: UInt = #line) -> Swift.Never {
|
||||
rxFatalError(message, file: file, line: line)
|
||||
}
|
||||
|
||||
func rxAbstractMethod() -> Swift.Never {
|
||||
rxFatalError("Abstract method")
|
||||
func rxFatalError(_ lastMessage: @autoclosure () -> String, file: StaticString = #file, line: UInt = #line) -> Swift.Never {
|
||||
// The temptation to comment this line is great, but please don't, it's for your own good. The choice is yours.
|
||||
fatalError(lastMessage(), file: file, line: line)
|
||||
}
|
||||
|
||||
func rxFatalErrorInDebug(_ lastMessage: @autoclosure () -> String, file: StaticString = #file, line: UInt = #line) {
|
||||
#if DEBUG
|
||||
fatalError(lastMessage(), file: file, line: line)
|
||||
#else
|
||||
print("\(file):\(line): \(lastMessage())")
|
||||
#endif
|
||||
}
|
||||
|
||||
// MARK: casts or fatal error
|
||||
|
1
Pods/RxCocoa/RxCocoa/macOS/NSButton+Rx.swift
generated
1
Pods/RxCocoa/RxCocoa/macOS/NSButton+Rx.swift
generated
@ -8,7 +8,6 @@
|
||||
|
||||
#if os(macOS)
|
||||
|
||||
import Foundation
|
||||
#if !RX_NO_MODULE
|
||||
import RxSwift
|
||||
#endif
|
||||
|
1
Pods/RxCocoa/RxCocoa/macOS/NSControl+Rx.swift
generated
1
Pods/RxCocoa/RxCocoa/macOS/NSControl+Rx.swift
generated
@ -8,7 +8,6 @@
|
||||
|
||||
#if os(macOS)
|
||||
|
||||
import Foundation
|
||||
import Cocoa
|
||||
#if !RX_NO_MODULE
|
||||
import RxSwift
|
||||
|
1
Pods/RxCocoa/RxCocoa/macOS/NSImageView+Rx.swift
generated
1
Pods/RxCocoa/RxCocoa/macOS/NSImageView+Rx.swift
generated
@ -8,7 +8,6 @@
|
||||
|
||||
#if os(macOS)
|
||||
|
||||
import Foundation
|
||||
#if !RX_NO_MODULE
|
||||
import RxSwift
|
||||
#endif
|
||||
|
1
Pods/RxCocoa/RxCocoa/macOS/NSSlider+Rx.swift
generated
1
Pods/RxCocoa/RxCocoa/macOS/NSSlider+Rx.swift
generated
@ -8,7 +8,6 @@
|
||||
|
||||
#if os(macOS)
|
||||
|
||||
import Foundation
|
||||
#if !RX_NO_MODULE
|
||||
import RxSwift
|
||||
#endif
|
||||
|
1
Pods/RxCocoa/RxCocoa/macOS/NSTextField+Rx.swift
generated
1
Pods/RxCocoa/RxCocoa/macOS/NSTextField+Rx.swift
generated
@ -8,7 +8,6 @@
|
||||
|
||||
#if os(macOS)
|
||||
|
||||
import Foundation
|
||||
import Cocoa
|
||||
#if !RX_NO_MODULE
|
||||
import RxSwift
|
||||
|
1
Pods/RxCocoa/RxCocoa/macOS/NSView+Rx.swift
generated
1
Pods/RxCocoa/RxCocoa/macOS/NSView+Rx.swift
generated
@ -8,7 +8,6 @@
|
||||
|
||||
#if os(macOS)
|
||||
|
||||
import Foundation
|
||||
import Cocoa
|
||||
#if !RX_NO_MODULE
|
||||
import RxSwift
|
||||
|
24
Pods/RxSwift/Platform/DataStructures/Bag.swift
generated
24
Pods/RxSwift/Platform/DataStructures/Bag.swift
generated
@ -6,7 +6,6 @@
|
||||
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Swift
|
||||
|
||||
let arrayDictionaryMaxSize = 30
|
||||
@ -44,6 +43,9 @@ struct Bag<T> : CustomDebugStringConvertible {
|
||||
var _key0: BagKey? = nil
|
||||
var _value0: T? = nil
|
||||
|
||||
// then fill "array dictionary"
|
||||
var _pairs = ContiguousArray<Entry>()
|
||||
|
||||
// last is sparse dictionary
|
||||
var _dictionary: [BagKey : T]? = nil
|
||||
|
||||
@ -77,6 +79,11 @@ struct Bag<T> : CustomDebugStringConvertible {
|
||||
return key
|
||||
}
|
||||
|
||||
if _pairs.count < arrayDictionaryMaxSize {
|
||||
_pairs.append(key: key, value: element)
|
||||
return key
|
||||
}
|
||||
|
||||
if _dictionary == nil {
|
||||
_dictionary = [:]
|
||||
}
|
||||
@ -89,7 +96,7 @@ struct Bag<T> : CustomDebugStringConvertible {
|
||||
/// - returns: Number of elements in bag.
|
||||
var count: Int {
|
||||
let dictionaryCount: Int = _dictionary?.count ?? 0
|
||||
return (_value0 != nil ? 1 : 0) + dictionaryCount
|
||||
return (_value0 != nil ? 1 : 0) + _pairs.count + dictionaryCount
|
||||
}
|
||||
|
||||
/// Removes all elements from bag and clears capacity.
|
||||
@ -97,6 +104,7 @@ struct Bag<T> : CustomDebugStringConvertible {
|
||||
_key0 = nil
|
||||
_value0 = nil
|
||||
|
||||
_pairs.removeAll(keepingCapacity: false)
|
||||
_dictionary?.removeAll(keepingCapacity: false)
|
||||
}
|
||||
|
||||
@ -118,6 +126,14 @@ struct Bag<T> : CustomDebugStringConvertible {
|
||||
return existingObject
|
||||
}
|
||||
|
||||
for i in 0 ..< _pairs.count {
|
||||
if _pairs[i].key == key {
|
||||
let value = _pairs[i].value
|
||||
_pairs.remove(at: i)
|
||||
return value
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
}
|
||||
@ -148,6 +164,10 @@ extension Bag {
|
||||
action(value0)
|
||||
}
|
||||
|
||||
for i in 0 ..< _pairs.count {
|
||||
action(_pairs[i].value)
|
||||
}
|
||||
|
||||
if dictionary?.count ?? 0 > 0 {
|
||||
for element in dictionary!.values {
|
||||
action(element)
|
||||
|
@ -6,8 +6,6 @@
|
||||
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/// Sequence that repeats `repeatedValue` infinite number of times.
|
||||
struct InfiniteSequence<E> : Sequence {
|
||||
typealias Element = E
|
||||
|
@ -6,8 +6,6 @@
|
||||
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
struct PriorityQueue<Element> {
|
||||
private let _hasHigherPriority: (Element, Element) -> Bool
|
||||
private let _isEqual: (Element, Element) -> Bool
|
||||
|
2
Pods/RxSwift/Platform/DataStructures/Queue.swift
generated
2
Pods/RxSwift/Platform/DataStructures/Queue.swift
generated
@ -6,8 +6,6 @@
|
||||
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/**
|
||||
Data structure that represents queue.
|
||||
|
||||
|
@ -6,7 +6,6 @@
|
||||
// Copyright © 2016 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Dispatch
|
||||
|
||||
extension DispatchQueue {
|
||||
|
23
Pods/RxSwift/Platform/Platform.Darwin.swift
generated
23
Pods/RxSwift/Platform/Platform.Darwin.swift
generated
@ -9,17 +9,34 @@
|
||||
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
|
||||
|
||||
import Darwin
|
||||
import Foundation
|
||||
import class Foundation.Thread
|
||||
import func Foundation.OSAtomicCompareAndSwap32Barrier
|
||||
import func Foundation.OSAtomicIncrement32Barrier
|
||||
import func Foundation.OSAtomicDecrement32Barrier
|
||||
import protocol Foundation.NSCopying
|
||||
|
||||
typealias AtomicInt = Int32
|
||||
|
||||
fileprivate func castToUInt32Pointer(_ pointer: UnsafeMutablePointer<Int32>) -> UnsafeMutablePointer<UInt32> {
|
||||
let raw = UnsafeMutableRawPointer(pointer)
|
||||
return raw.assumingMemoryBound(to: UInt32.self)
|
||||
}
|
||||
|
||||
let AtomicCompareAndSwap = OSAtomicCompareAndSwap32Barrier
|
||||
let AtomicIncrement = OSAtomicIncrement32Barrier
|
||||
let AtomicDecrement = OSAtomicDecrement32Barrier
|
||||
func AtomicOr(_ mask: UInt32, _ theValue : UnsafeMutablePointer<Int32>) -> Int32 {
|
||||
return OSAtomicOr32OrigBarrier(mask, castToUInt32Pointer(theValue))
|
||||
}
|
||||
func AtomicFlagSet(_ mask: UInt32, _ theValue : UnsafeMutablePointer<Int32>) -> Bool {
|
||||
// just used to create a barrier
|
||||
OSAtomicXor32OrigBarrier(0, castToUInt32Pointer(theValue))
|
||||
return (theValue.pointee & Int32(mask)) != 0
|
||||
}
|
||||
|
||||
extension Thread {
|
||||
|
||||
static func setThreadLocalStorageValue<T: AnyObject>(_ value: T?, forKey key: String
|
||||
static func setThreadLocalStorageValue<T: AnyObject>(_ value: T?, forKey key: NSCopying
|
||||
) {
|
||||
let currentThread = Thread.current
|
||||
let threadDictionary = currentThread.threadDictionary
|
||||
@ -32,7 +49,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
static func getThreadLocalStorageValueForKey<T>(_ key: String) -> T? {
|
||||
static func getThreadLocalStorageValueForKey<T>(_ key: NSCopying) -> T? {
|
||||
let currentThread = Thread.current
|
||||
let threadDictionary = currentThread.threadDictionary
|
||||
|
||||
|
20
Pods/RxSwift/Platform/Platform.Linux.swift
generated
20
Pods/RxSwift/Platform/Platform.Linux.swift
generated
@ -7,20 +7,16 @@
|
||||
//
|
||||
|
||||
#if os(Linux)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// This is not the greatest API in the world, this is just a tribute.
|
||||
// !!! Proof of concept until libdispatch becomes operational. !!!
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
import Foundation
|
||||
import XCTest
|
||||
import Glibc
|
||||
import SwiftShims
|
||||
import class Foundation.Thread
|
||||
|
||||
final class AtomicInt {
|
||||
typealias IntegerLiteralType = Int
|
||||
fileprivate var value: Int32 = 0
|
||||
fileprivate var _lock = NSRecursiveLock()
|
||||
fileprivate var _lock = RecursiveLock()
|
||||
|
||||
func lock() {
|
||||
_lock.lock()
|
||||
@ -48,6 +44,18 @@
|
||||
return lhs.value == rhs
|
||||
}
|
||||
|
||||
func AtomicFlagSet(_ mask: UInt32, _ atomic: inout AtomicInt) -> Bool {
|
||||
atomic.lock(); defer { atomic.unlock() }
|
||||
return (atomic.value & Int32(mask)) != 0
|
||||
}
|
||||
|
||||
func AtomicOr(_ mask: UInt32, _ atomic: inout AtomicInt) -> Int32 {
|
||||
atomic.lock(); defer { atomic.unlock() }
|
||||
let value = atomic.value
|
||||
atomic.value |= Int32(mask)
|
||||
return value
|
||||
}
|
||||
|
||||
func AtomicIncrement(_ atomic: inout AtomicInt) -> Int32 {
|
||||
atomic.lock(); defer { atomic.unlock() }
|
||||
atomic.value += 1
|
||||
|
34
Pods/RxSwift/Platform/RecursiveLock.swift
generated
Normal file
34
Pods/RxSwift/Platform/RecursiveLock.swift
generated
Normal file
@ -0,0 +1,34 @@
|
||||
//
|
||||
// RecursiveLock.swift
|
||||
// Platform
|
||||
//
|
||||
// Created by Krunoslav Zaher on 12/18/16.
|
||||
// Copyright © 2016 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
#if TRACE_RESOURCES
|
||||
class RecursiveLock: NSRecursiveLock {
|
||||
override init() {
|
||||
_ = Resources.incrementTotal()
|
||||
super.init()
|
||||
}
|
||||
|
||||
override func lock() {
|
||||
super.lock()
|
||||
_ = Resources.incrementTotal()
|
||||
}
|
||||
|
||||
override func unlock() {
|
||||
super.unlock()
|
||||
_ = Resources.decrementTotal()
|
||||
}
|
||||
|
||||
deinit {
|
||||
_ = Resources.decrementTotal()
|
||||
}
|
||||
}
|
||||
#else
|
||||
typealias RecursiveLock = NSRecursiveLock
|
||||
#endif
|
16
Pods/RxSwift/README.md
generated
16
Pods/RxSwift/README.md
generated
@ -45,7 +45,7 @@ KVO observing, async operations and streams are all unified under [abstraction o
|
||||
|
||||
###### ... interact
|
||||
|
||||
* All of this is great, but it would be nice to talk with other people using RxSwift and exchange experiences. <br />[](http://slack.rxswift.org) [Join Slack Channel](http://rxswift-slack.herokuapp.com)
|
||||
* All of this is great, but it would be nice to talk with other people using RxSwift and exchange experiences. <br />[](http://rxswift-slack.herokuapp.com/) [Join Slack Channel](http://rxswift-slack.herokuapp.com)
|
||||
* Report a problem using the library. [Open an Issue With Bug Template](.github/ISSUE_TEMPLATE.md)
|
||||
* Request a new feature. [Open an Issue With Feature Request Template](Documentation/NewFeatureRequestTemplate.md)
|
||||
|
||||
@ -102,7 +102,7 @@ searchResults
|
||||
cell.textLabel?.text = repository.name
|
||||
cell.detailTextLabel?.text = repository.url
|
||||
}
|
||||
.addDisposableTo(disposeBag)</pre></div></td>
|
||||
.disposed(by: disposeBag)</pre></div></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@ -126,7 +126,7 @@ Open Rx.xcworkspace, choose `RxExample` and hit run. This method will build ever
|
||||
|
||||
**Tested with `pod --version`: `1.1.1`**
|
||||
|
||||
```
|
||||
```ruby
|
||||
# Podfile
|
||||
use_frameworks!
|
||||
|
||||
@ -144,7 +144,7 @@ end
|
||||
|
||||
Replace `YOUR_TARGET_NAME` and then, in the `Podfile` directory, type:
|
||||
|
||||
```
|
||||
```bash
|
||||
$ pod install
|
||||
```
|
||||
|
||||
@ -158,7 +158,7 @@ Add this to `Cartfile`
|
||||
github "ReactiveX/RxSwift" ~> 3.0
|
||||
```
|
||||
|
||||
```
|
||||
```bash
|
||||
$ carthage update
|
||||
```
|
||||
|
||||
@ -168,7 +168,7 @@ $ carthage update
|
||||
|
||||
Create a `Package.swift` file.
|
||||
|
||||
```
|
||||
```swift
|
||||
import PackageDescription
|
||||
|
||||
let package = Package(
|
||||
@ -180,7 +180,7 @@ let package = Package(
|
||||
)
|
||||
```
|
||||
|
||||
```
|
||||
```bash
|
||||
$ swift build
|
||||
```
|
||||
|
||||
@ -188,7 +188,7 @@ $ swift build
|
||||
|
||||
* Add RxSwift as a submodule
|
||||
|
||||
```
|
||||
```bash
|
||||
$ git submodule add git@github.com:ReactiveX/RxSwift.git
|
||||
```
|
||||
|
||||
|
7
Pods/RxSwift/RxSwift/AnyObserver.swift
generated
7
Pods/RxSwift/RxSwift/AnyObserver.swift
generated
@ -6,8 +6,6 @@
|
||||
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/// A type-erased `ObserverType`.
|
||||
///
|
||||
/// Forwards operations to an arbitrary underlying observer with the same `Element` type, hiding the specifics of the underlying observer type.
|
||||
@ -49,6 +47,11 @@ public struct AnyObserver<Element> : ObserverType {
|
||||
}
|
||||
}
|
||||
|
||||
extension AnyObserver {
|
||||
/// Collection of `AnyObserver`s
|
||||
typealias s = Bag<(Event<Element>) -> ()>
|
||||
}
|
||||
|
||||
extension ObserverType {
|
||||
/// Erases type of observer and returns canonical observer.
|
||||
///
|
||||
|
2
Pods/RxSwift/RxSwift/Cancelable.swift
generated
2
Pods/RxSwift/RxSwift/Cancelable.swift
generated
@ -6,8 +6,6 @@
|
||||
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/// Represents disposable resource with state tracking.
|
||||
public protocol Cancelable : Disposable {
|
||||
/// Was resource disposed.
|
||||
|
4
Pods/RxSwift/RxSwift/Concurrency/AsyncLock.swift
generated
4
Pods/RxSwift/RxSwift/Concurrency/AsyncLock.swift
generated
@ -6,8 +6,6 @@
|
||||
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/**
|
||||
In case nobody holds this lock, the work will be queued and executed immediately
|
||||
on thread that is requesting lock.
|
||||
@ -18,7 +16,7 @@ and pending work.
|
||||
|
||||
That means that enqueued work could possibly be executed later on a different thread.
|
||||
*/
|
||||
class AsyncLock<I: InvocableType>
|
||||
final class AsyncLock<I: InvocableType>
|
||||
: Disposable
|
||||
, Lock
|
||||
, SynchronizedDisposeType {
|
||||
|
12
Pods/RxSwift/RxSwift/Concurrency/Lock.swift
generated
12
Pods/RxSwift/RxSwift/Concurrency/Lock.swift
generated
@ -6,31 +6,29 @@
|
||||
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
protocol Lock {
|
||||
func lock()
|
||||
func unlock()
|
||||
}
|
||||
|
||||
// https://lists.swift.org/pipermail/swift-dev/Week-of-Mon-20151214/000321.html
|
||||
typealias SpinLock = NSRecursiveLock
|
||||
typealias SpinLock = RecursiveLock
|
||||
|
||||
extension NSRecursiveLock : Lock {
|
||||
extension RecursiveLock : Lock {
|
||||
@inline(__always)
|
||||
func performLocked(_ action: () -> Void) {
|
||||
final func performLocked(_ action: () -> Void) {
|
||||
lock(); defer { unlock() }
|
||||
action()
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
func calculateLocked<T>(_ action: () -> T) -> T {
|
||||
final func calculateLocked<T>(_ action: () -> T) -> T {
|
||||
lock(); defer { unlock() }
|
||||
return action()
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
func calculateLockedOrFail<T>(_ action: () throws -> T) throws -> T {
|
||||
final func calculateLockedOrFail<T>(_ action: () throws -> T) throws -> T {
|
||||
lock(); defer { unlock() }
|
||||
let result = try action()
|
||||
return result
|
||||
|
@ -6,10 +6,8 @@
|
||||
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
protocol LockOwnerType : class, Lock {
|
||||
var _lock: NSRecursiveLock { get }
|
||||
var _lock: RecursiveLock { get }
|
||||
}
|
||||
|
||||
extension LockOwnerType {
|
||||
|
@ -6,8 +6,6 @@
|
||||
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
protocol SynchronizedDisposeType : class, Disposable, Lock {
|
||||
func _synchronized_dispose()
|
||||
}
|
||||
|
@ -6,8 +6,6 @@
|
||||
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
protocol SynchronizedOnType : class, ObserverType, Lock {
|
||||
func _synchronized_on(_ event: Event<E>)
|
||||
}
|
||||
|
@ -6,8 +6,6 @@
|
||||
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
protocol SynchronizedSubscribeType : class, ObservableType, Lock {
|
||||
func _synchronized_subscribe<O: ObserverType>(_ observer: O) -> Disposable where O.E == E
|
||||
}
|
||||
|
@ -6,8 +6,6 @@
|
||||
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
protocol SynchronizedUnsubscribeType : class {
|
||||
associatedtype DisposeKey
|
||||
|
||||
|
@ -6,8 +6,6 @@
|
||||
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/**
|
||||
Represents an observable sequence wrapper that can be connected and disconnected from its underlying observable sequence.
|
||||
*/
|
||||
|
49
Pods/RxSwift/RxSwift/Deprecated.swift
generated
Normal file
49
Pods/RxSwift/RxSwift/Deprecated.swift
generated
Normal file
@ -0,0 +1,49 @@
|
||||
//
|
||||
// Deprecated.swift
|
||||
// RxSwift
|
||||
//
|
||||
// Created by Krunoslav Zaher on 3/5/17.
|
||||
// Copyright © 2017 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
extension Observable {
|
||||
/**
|
||||
Converts a optional to an observable sequence.
|
||||
|
||||
- seealso: [from operator on reactivex.io](http://reactivex.io/documentation/operators/from.html)
|
||||
|
||||
- parameter optional: Optional element in the resulting observable sequence.
|
||||
- returns: An observable sequence containing the wrapped value or not from given optional.
|
||||
*/
|
||||
@available(*, deprecated, message: "Implicit conversions from any type to optional type are allowed and that is causing issues with `from` operator overloading.", renamed: "from(optional:)")
|
||||
public static func from(_ optional: E?) -> Observable<E> {
|
||||
return ObservableOptional(optional: optional)
|
||||
}
|
||||
|
||||
/**
|
||||
Converts a optional to an observable sequence.
|
||||
|
||||
- seealso: [from operator on reactivex.io](http://reactivex.io/documentation/operators/from.html)
|
||||
|
||||
- parameter optional: Optional element in the resulting observable sequence.
|
||||
- parameter: Scheduler to send the optional element on.
|
||||
- returns: An observable sequence containing the wrapped value or not from given optional.
|
||||
*/
|
||||
@available(*, deprecated, message: "Implicit conversions from any type to optional type are allowed and that is causing issues with `from` operator overloading.", renamed: "from(optional:scheduler:)")
|
||||
public static func from(_ optional: E?, scheduler: ImmediateSchedulerType) -> Observable<E> {
|
||||
return ObservableOptionalScheduled(optional: optional, scheduler: scheduler)
|
||||
}
|
||||
}
|
||||
|
||||
extension Disposable {
|
||||
/// Deprecated in favor of `disposed(by:)`
|
||||
///
|
||||
/// **@available(\*, deprecated, message="use disposed(by:) instead")**
|
||||
///
|
||||
/// Adds `self` to `bag`.
|
||||
///
|
||||
/// - parameter bag: `DisposeBag` to add `self` to.
|
||||
public func addDisposableTo(_ bag: DisposeBag) {
|
||||
disposed(by: bag)
|
||||
}
|
||||
}
|
2
Pods/RxSwift/RxSwift/Disposable.swift
generated
2
Pods/RxSwift/RxSwift/Disposable.swift
generated
@ -6,8 +6,6 @@
|
||||
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/// Respresents a disposable resource.
|
||||
public protocol Disposable {
|
||||
/// Dispose resource.
|
||||
|
@ -6,8 +6,6 @@
|
||||
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/// Represents an Action-based disposable.
|
||||
///
|
||||
/// When dispose method is called, disposal action will be dereferenced.
|
||||
|
@ -6,8 +6,6 @@
|
||||
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/// Represents two disposable resources that are disposed together.
|
||||
private final class BinaryDisposable : DisposeBase, Cancelable {
|
||||
|
||||
|
@ -6,8 +6,6 @@
|
||||
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/// Represents a disposable resource that can be checked for disposal status.
|
||||
public final class BooleanDisposable : Disposable, Cancelable {
|
||||
|
||||
|
@ -6,8 +6,6 @@
|
||||
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/// Represents a group of disposable resources that are disposed together.
|
||||
public final class CompositeDisposable : DisposeBase, Disposable, Cancelable {
|
||||
/// Key used to remove disposable from composite disposable
|
||||
|
@ -6,8 +6,6 @@
|
||||
// Copyright © 2016 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/// A collection of utility methods for common disposable operations.
|
||||
public struct Disposables {
|
||||
private init() {}
|
||||
|
@ -6,13 +6,11 @@
|
||||
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
extension Disposable {
|
||||
/// Adds `self` to `bag`.
|
||||
/// Adds `self` to `bag`
|
||||
///
|
||||
/// - parameter bag: `DisposeBag` to add `self` to.
|
||||
public func addDisposableTo(_ bag: DisposeBag) {
|
||||
public func disposed(by bag: DisposeBag) {
|
||||
bag.insert(self)
|
||||
}
|
||||
}
|
||||
|
@ -6,8 +6,6 @@
|
||||
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/// Base class for all disposables.
|
||||
public class DisposeBase {
|
||||
init() {
|
||||
|
@ -6,8 +6,6 @@
|
||||
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/// Represents a disposable that does nothing on disposal.
|
||||
///
|
||||
/// Nop = No Operation
|
||||
|
@ -6,8 +6,6 @@
|
||||
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/// Represents a disposable resource that only disposes its underlying disposable resource when all dependent disposable objects have been disposed.
|
||||
public final class RefCountDisposable : DisposeBase, Cancelable {
|
||||
private var _lock = SpinLock()
|
||||
|
@ -6,8 +6,6 @@
|
||||
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
private let disposeScheduledDisposable: (ScheduledDisposable) -> Disposable = { sd in
|
||||
sd.disposeInner()
|
||||
return Disposables.create()
|
||||
|
@ -6,8 +6,6 @@
|
||||
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/// Represents a disposable resource whose underlying disposable resource can be replaced by another disposable resource, causing automatic disposal of the previous underlying disposable resource.
|
||||
public final class SerialDisposable : DisposeBase, Cancelable {
|
||||
private var _lock = SpinLock()
|
||||
|
@ -6,17 +6,12 @@
|
||||
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/**
|
||||
Represents a disposable resource which only allows a single assignment of its underlying disposable resource.
|
||||
|
||||
If an underlying disposable resource has already been set, future attempts to set the underlying disposable resource will throw an exception.
|
||||
*/
|
||||
public class SingleAssignmentDisposable : DisposeBase, Disposable, Cancelable {
|
||||
#if os(Linux)
|
||||
fileprivate let _lock = SpinLock()
|
||||
#endif
|
||||
public final class SingleAssignmentDisposable : DisposeBase, Disposable, Cancelable {
|
||||
|
||||
fileprivate enum DisposeState: UInt32 {
|
||||
case disposed = 1
|
||||
@ -30,12 +25,12 @@ public class SingleAssignmentDisposable : DisposeBase, Disposable, Cancelable {
|
||||
}
|
||||
|
||||
// state
|
||||
private var _state: UInt32 = 0
|
||||
private var _state: AtomicInt = 0
|
||||
private var _disposable = nil as Disposable?
|
||||
|
||||
/// - returns: A value that indicates whether the object is disposed.
|
||||
public var isDisposed: Bool {
|
||||
return (_state & DisposeState.disposed.rawValue) != 0
|
||||
return AtomicFlagSet(DisposeState.disposed.rawValue, &_state)
|
||||
}
|
||||
|
||||
/// Initializes a new instance of the `SingleAssignmentDisposable`.
|
||||
@ -49,15 +44,7 @@ public class SingleAssignmentDisposable : DisposeBase, Disposable, Cancelable {
|
||||
public func setDisposable(_ disposable: Disposable) {
|
||||
_disposable = disposable
|
||||
|
||||
#if os(Linux)
|
||||
_lock.lock()
|
||||
let previousState = Int32(_state)
|
||||
_state = _state | DisposeState.disposableSet.rawValue
|
||||
// We know about `defer { _lock.unlock() }`, but this resolves Swift compiler bug. Using `defer` here causes anomaly.
|
||||
_lock.unlock()
|
||||
#else
|
||||
let previousState = OSAtomicOr32OrigBarrier(DisposeState.disposableSet.rawValue, &_state)
|
||||
#endif
|
||||
let previousState = AtomicOr(DisposeState.disposableSet.rawValue, &_state)
|
||||
|
||||
if (previousState & DisposeStateInt32.disposableSet.rawValue) != 0 {
|
||||
rxFatalError("oldState.disposable != nil")
|
||||
@ -71,15 +58,7 @@ public class SingleAssignmentDisposable : DisposeBase, Disposable, Cancelable {
|
||||
|
||||
/// Disposes the underlying disposable.
|
||||
public func dispose() {
|
||||
#if os(Linux)
|
||||
_lock.lock()
|
||||
let previousState = Int32(_state)
|
||||
_state = _state | DisposeState.disposed.rawValue
|
||||
// We know about `defer { _lock.unlock() }`, but this resolves Swift compiler bug. Using `defer` here causes anomaly.
|
||||
_lock.unlock()
|
||||
#else
|
||||
let previousState = OSAtomicOr32OrigBarrier(DisposeState.disposed.rawValue, &_state)
|
||||
#endif
|
||||
let previousState = AtomicOr(DisposeState.disposed.rawValue, &_state)
|
||||
|
||||
if (previousState & DisposeStateInt32.disposed.rawValue) != 0 {
|
||||
return
|
||||
|
@ -6,8 +6,6 @@
|
||||
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
struct SubscriptionDisposable<T: SynchronizedUnsubscribeType> : Disposable {
|
||||
private let _key: T.DisposeKey
|
||||
private weak var _owner: T?
|
||||
|
2
Pods/RxSwift/RxSwift/Errors.swift
generated
2
Pods/RxSwift/RxSwift/Errors.swift
generated
@ -6,8 +6,6 @@
|
||||
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
let RxErrorDomain = "RxErrorDomain"
|
||||
let RxCompositeFailures = "RxCompositeFailures"
|
||||
|
||||
|
2
Pods/RxSwift/RxSwift/Event.swift
generated
2
Pods/RxSwift/RxSwift/Event.swift
generated
@ -6,8 +6,6 @@
|
||||
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/// Represents a sequence event.
|
||||
///
|
||||
/// Sequence grammar:
|
||||
|
44
Pods/RxSwift/RxSwift/Extensions/Bag+Rx.swift
generated
44
Pods/RxSwift/RxSwift/Extensions/Bag+Rx.swift
generated
@ -6,32 +6,31 @@
|
||||
// Copyright © 2016 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
// MARK: forEach
|
||||
|
||||
extension Bag where T: ObserverType {
|
||||
/// Dispatches `event` to app observers contained inside bag.
|
||||
///
|
||||
/// - parameter action: Enumeration closure.
|
||||
func on(_ event: Event<T.E>) {
|
||||
if _onlyFastPath {
|
||||
_value0?.on(event)
|
||||
return
|
||||
}
|
||||
@inline(__always)
|
||||
func dispatch<E>(_ bag: Bag<(Event<E>) -> ()>, _ event: Event<E>) {
|
||||
if bag._onlyFastPath {
|
||||
bag._value0?(event)
|
||||
return
|
||||
}
|
||||
|
||||
let value0 = _value0
|
||||
let dictionary = _dictionary
|
||||
let value0 = bag._value0
|
||||
let dictionary = bag._dictionary
|
||||
|
||||
if let value0 = value0 {
|
||||
value0.on(event)
|
||||
}
|
||||
if let value0 = value0 {
|
||||
value0(event)
|
||||
}
|
||||
|
||||
if let dictionary = dictionary {
|
||||
for element in dictionary.values {
|
||||
element.on(event)
|
||||
}
|
||||
let pairs = bag._pairs
|
||||
for i in 0 ..< pairs.count {
|
||||
pairs[i].value(event)
|
||||
}
|
||||
|
||||
if let dictionary = dictionary {
|
||||
for element in dictionary.values {
|
||||
element(event)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -50,6 +49,11 @@ func disposeAll(in bag: Bag<Disposable>) {
|
||||
value0.dispose()
|
||||
}
|
||||
|
||||
let pairs = bag._pairs
|
||||
for i in 0 ..< pairs.count {
|
||||
pairs[i].value.dispose()
|
||||
}
|
||||
|
||||
if let dictionary = dictionary {
|
||||
for element in dictionary.values {
|
||||
element.dispose()
|
||||
|
2
Pods/RxSwift/RxSwift/Extensions/String+Rx.swift
generated
2
Pods/RxSwift/RxSwift/Extensions/String+Rx.swift
generated
@ -6,8 +6,6 @@
|
||||
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
extension String {
|
||||
/// This is needed because on Linux Swift doesn't have `rangeOfString(..., options: .BackwardsSearch)`
|
||||
func lastIndexOf(_ character: Character) -> Index? {
|
||||
|
37
Pods/RxSwift/RxSwift/GroupedObservable.swift
generated
Normal file
37
Pods/RxSwift/RxSwift/GroupedObservable.swift
generated
Normal file
@ -0,0 +1,37 @@
|
||||
//
|
||||
// GroupedObservable.swift
|
||||
// RxSwift
|
||||
//
|
||||
// Created by Tomi Koskinen on 01/12/15.
|
||||
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
/// Represents an observable sequence of elements that have a common key.
|
||||
public struct GroupedObservable<Key, Element> : ObservableType {
|
||||
public typealias E = Element
|
||||
|
||||
/// Gets the common key.
|
||||
public let key: Key
|
||||
|
||||
private let source: Observable<Element>
|
||||
|
||||
/// Initializes grouped observable sequence with key and source observable sequence.
|
||||
///
|
||||
/// - parameter key: Grouped observable sequence key
|
||||
/// - parameter source: Observable sequence that represents sequence of elements for the key
|
||||
/// - returns: Grouped observable sequence of elements for the specific key
|
||||
public init(key: Key, source: Observable<Element>) {
|
||||
self.key = key
|
||||
self.source = source
|
||||
}
|
||||
|
||||
/// Subscribes `observer` to receive events for this sequence.
|
||||
public func subscribe<O : ObserverType>(_ observer: O) -> Disposable where O.E == E {
|
||||
return self.source.subscribe(observer)
|
||||
}
|
||||
|
||||
/// Converts `self` to `Observable` sequence.
|
||||
public func asObservable() -> Observable<Element> {
|
||||
return source
|
||||
}
|
||||
}
|
@ -6,8 +6,6 @@
|
||||
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/// Represents an object that immediately schedules units of work.
|
||||
public protocol ImmediateSchedulerType {
|
||||
/**
|
||||
|
4
Pods/RxSwift/RxSwift/Observable.swift
generated
4
Pods/RxSwift/RxSwift/Observable.swift
generated
@ -6,8 +6,6 @@
|
||||
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/// A type-erased `ObservableType`.
|
||||
///
|
||||
/// It represents a push style sequence.
|
||||
@ -22,7 +20,7 @@ public class Observable<Element> : ObservableType {
|
||||
}
|
||||
|
||||
public func subscribe<O: ObserverType>(_ observer: O) -> Disposable where O.E == E {
|
||||
abstractMethod()
|
||||
rxAbstractMethod()
|
||||
}
|
||||
|
||||
public func asObservable() -> Observable<E> {
|
||||
|
@ -6,8 +6,6 @@
|
||||
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/// Type that can be converted to observable sequence (`Observer<E>`).
|
||||
public protocol ObservableConvertibleType {
|
||||
/// Type of elements in sequence.
|
||||
|
@ -6,8 +6,6 @@
|
||||
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
extension ObservableType {
|
||||
/**
|
||||
Subscribes an event handler to an observable sequence.
|
||||
@ -113,7 +111,7 @@ extension ObservableType {
|
||||
|
||||
extension ObservableType {
|
||||
/// All internal subscribe calls go through this method.
|
||||
func subscribeSafe<O: ObserverType>(_ observer: O) -> Disposable where O.E == E {
|
||||
fileprivate func subscribeSafe<O: ObserverType>(_ observer: O) -> Disposable where O.E == E {
|
||||
return self.asObservable().subscribe(observer)
|
||||
}
|
||||
}
|
||||
|
2
Pods/RxSwift/RxSwift/ObservableType.swift
generated
2
Pods/RxSwift/RxSwift/ObservableType.swift
generated
@ -6,8 +6,6 @@
|
||||
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/// Represents a push style sequence.
|
||||
public protocol ObservableType : ObservableConvertibleType {
|
||||
/// Type of elements in sequence.
|
||||
|
@ -6,9 +6,7 @@
|
||||
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
class AddRefSink<O: ObserverType> : Sink<O>, ObserverType {
|
||||
final class AddRefSink<O: ObserverType> : Sink<O>, ObserverType {
|
||||
typealias Element = O.E
|
||||
|
||||
override init(observer: O, cancel: Cancelable) {
|
||||
@ -26,7 +24,7 @@ class AddRefSink<O: ObserverType> : Sink<O>, ObserverType {
|
||||
}
|
||||
}
|
||||
|
||||
class AddRef<Element> : Producer<Element> {
|
||||
final class AddRef<Element> : Producer<Element> {
|
||||
typealias EventHandler = (Event<Element>) throws -> Void
|
||||
|
||||
private let _source: Observable<Element>
|
||||
@ -40,7 +38,7 @@ class AddRef<Element> : Producer<Element> {
|
||||
override func run<O: ObserverType>(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == Element {
|
||||
let releaseDisposable = _refCount.retain()
|
||||
let sink = AddRefSink(observer: observer, cancel: cancel)
|
||||
let subscription = Disposables.create(releaseDisposable, _source.subscribeSafe(sink))
|
||||
let subscription = Disposables.create(releaseDisposable, _source.subscribe(sink))
|
||||
|
||||
return (sink: sink, subscription: subscription)
|
||||
}
|
||||
|
@ -6,15 +6,13 @@
|
||||
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
enum AmbState {
|
||||
case neither
|
||||
case left
|
||||
case right
|
||||
}
|
||||
|
||||
class AmbObserver<O: ObserverType> : ObserverType {
|
||||
final class AmbObserver<O: ObserverType> : ObserverType {
|
||||
typealias Element = O.E
|
||||
typealias Parent = AmbSink<O>
|
||||
typealias This = AmbObserver<O>
|
||||
@ -48,14 +46,14 @@ class AmbObserver<O: ObserverType> : ObserverType {
|
||||
}
|
||||
}
|
||||
|
||||
class AmbSink<O: ObserverType> : Sink<O> {
|
||||
final class AmbSink<O: ObserverType> : Sink<O> {
|
||||
typealias ElementType = O.E
|
||||
typealias Parent = Amb<ElementType>
|
||||
typealias AmbObserverType = AmbObserver<O>
|
||||
|
||||
private let _parent: Parent
|
||||
|
||||
private let _lock = NSRecursiveLock()
|
||||
private let _lock = RecursiveLock()
|
||||
// state
|
||||
private var _choice = AmbState.neither
|
||||
|
||||
@ -71,6 +69,9 @@ class AmbSink<O: ObserverType> : Sink<O> {
|
||||
|
||||
let forwardEvent = { (o: AmbObserverType, event: Event<ElementType>) -> Void in
|
||||
self.forwardOn(event)
|
||||
if event.isStopEvent {
|
||||
self.dispose()
|
||||
}
|
||||
}
|
||||
|
||||
let decide = { (o: AmbObserverType, event: Event<ElementType>, me: AmbState, otherSubscription: Disposable) in
|
||||
@ -106,7 +107,7 @@ class AmbSink<O: ObserverType> : Sink<O> {
|
||||
}
|
||||
}
|
||||
|
||||
class Amb<Element>: Producer<Element> {
|
||||
final class Amb<Element>: Producer<Element> {
|
||||
fileprivate let _left: Observable<Element>
|
||||
fileprivate let _right: Observable<Element>
|
||||
|
||||
|
@ -6,20 +6,31 @@
|
||||
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
class AnonymousObservableSink<O: ObserverType> : Sink<O>, ObserverType {
|
||||
final class AnonymousObservableSink<O: ObserverType> : Sink<O>, ObserverType {
|
||||
typealias E = O.E
|
||||
typealias Parent = AnonymousObservable<E>
|
||||
|
||||
// state
|
||||
private var _isStopped: AtomicInt = 0
|
||||
|
||||
#if DEBUG
|
||||
fileprivate var _numberOfConcurrentCalls: AtomicInt = 0
|
||||
#endif
|
||||
|
||||
override init(observer: O, cancel: Cancelable) {
|
||||
super.init(observer: observer, cancel: cancel)
|
||||
}
|
||||
|
||||
func on(_ event: Event<E>) {
|
||||
#if DEBUG
|
||||
if AtomicIncrement(&_numberOfConcurrentCalls) > 1 {
|
||||
rxFatalError("Warning: Recursive call or synchronization error!")
|
||||
}
|
||||
|
||||
defer {
|
||||
_ = AtomicDecrement(&_numberOfConcurrentCalls)
|
||||
}
|
||||
#endif
|
||||
switch event {
|
||||
case .next:
|
||||
if _isStopped == 1 {
|
||||
@ -39,7 +50,7 @@ class AnonymousObservableSink<O: ObserverType> : Sink<O>, ObserverType {
|
||||
}
|
||||
}
|
||||
|
||||
class AnonymousObservable<Element> : Producer<Element> {
|
||||
final class AnonymousObservable<Element> : Producer<Element> {
|
||||
typealias SubscribeHandler = (AnyObserver<Element>) -> Disposable
|
||||
|
||||
let _subscribeHandler: SubscribeHandler
|
||||
|
49
Pods/RxSwift/RxSwift/Observables/Implementations/AsMaybe.swift
generated
Normal file
49
Pods/RxSwift/RxSwift/Observables/Implementations/AsMaybe.swift
generated
Normal file
@ -0,0 +1,49 @@
|
||||
//
|
||||
// AsMaybe.swift
|
||||
// RxSwift
|
||||
//
|
||||
// Created by Krunoslav Zaher on 3/12/17.
|
||||
// Copyright © 2017 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
fileprivate final class AsMaybeSink<O: ObserverType> : Sink<O>, ObserverType {
|
||||
typealias ElementType = O.E
|
||||
typealias E = ElementType
|
||||
|
||||
private var _element: Event<E>? = nil
|
||||
|
||||
func on(_ event: Event<E>) {
|
||||
switch event {
|
||||
case .next:
|
||||
if _element != nil {
|
||||
forwardOn(.error(RxError.moreThanOneElement))
|
||||
dispose()
|
||||
}
|
||||
|
||||
_element = event
|
||||
case .error:
|
||||
forwardOn(event)
|
||||
dispose()
|
||||
case .completed:
|
||||
if let element = _element {
|
||||
forwardOn(element)
|
||||
}
|
||||
forwardOn(.completed)
|
||||
dispose()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final class AsMaybe<Element>: Producer<Element> {
|
||||
fileprivate let _source: Observable<Element>
|
||||
|
||||
init(source: Observable<Element>) {
|
||||
_source = source
|
||||
}
|
||||
|
||||
override func run<O : ObserverType>(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == Element {
|
||||
let sink = AsMaybeSink(observer: observer, cancel: cancel)
|
||||
let subscription = _source.subscribe(sink)
|
||||
return (sink: sink, subscription: subscription)
|
||||
}
|
||||
}
|
52
Pods/RxSwift/RxSwift/Observables/Implementations/AsSingle.swift
generated
Normal file
52
Pods/RxSwift/RxSwift/Observables/Implementations/AsSingle.swift
generated
Normal file
@ -0,0 +1,52 @@
|
||||
//
|
||||
// AsSingle.swift
|
||||
// RxSwift
|
||||
//
|
||||
// Created by Krunoslav Zaher on 3/12/17.
|
||||
// Copyright © 2017 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
fileprivate final class AsSingleSink<O: ObserverType> : Sink<O>, ObserverType {
|
||||
typealias ElementType = O.E
|
||||
typealias E = ElementType
|
||||
|
||||
private var _element: Event<E>? = nil
|
||||
|
||||
func on(_ event: Event<E>) {
|
||||
switch event {
|
||||
case .next:
|
||||
if _element != nil {
|
||||
forwardOn(.error(RxError.moreThanOneElement))
|
||||
dispose()
|
||||
}
|
||||
|
||||
_element = event
|
||||
case .error:
|
||||
forwardOn(event)
|
||||
dispose()
|
||||
case .completed:
|
||||
if let element = _element {
|
||||
forwardOn(element)
|
||||
forwardOn(.completed)
|
||||
}
|
||||
else {
|
||||
forwardOn(.error(RxError.noElements))
|
||||
}
|
||||
dispose()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final class AsSingle<Element>: Producer<Element> {
|
||||
fileprivate let _source: Observable<Element>
|
||||
|
||||
init(source: Observable<Element>) {
|
||||
_source = source
|
||||
}
|
||||
|
||||
override func run<O : ObserverType>(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == Element {
|
||||
let sink = AsSingleSink(observer: observer, cancel: cancel)
|
||||
let subscription = _source.subscribe(sink)
|
||||
return (sink: sink, subscription: subscription)
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user