Upgrade version of RxSwift, RxCocoa, Alamofire.

This commit is contained in:
Qiu Yuzhou
2018-05-08 11:45:43 +08:00
parent 99595faafa
commit ce00520dfd
155 changed files with 6172 additions and 5740 deletions

View File

@ -80,15 +80,11 @@ struct Bag<T> : CustomDebugStringConvertible {
}
if _pairs.count < arrayDictionaryMaxSize {
_pairs.append(key: key, value: element)
_pairs.append((key: key, value: element))
return key
}
if _dictionary == nil {
_dictionary = [:]
}
_dictionary![key] = element
_dictionary = [key: element]
return key
}

View File

@ -52,7 +52,11 @@ struct PriorityQueue<Element> {
private mutating func removeAt(_ index: Int) {
let removingLast = index == _elements.count - 1
if !removingLast {
#if swift(>=3.2)
_elements.swapAt(index, _elements.count - 1)
#else
swap(&_elements[index], &_elements[_elements.count - 1])
#endif
}
_ = _elements.popLast()
@ -72,8 +76,11 @@ struct PriorityQueue<Element> {
while unbalancedIndex > 0 {
let parentIndex = (unbalancedIndex - 1) / 2
guard _hasHigherPriority(_elements[unbalancedIndex], _elements[parentIndex]) else { break }
#if swift(>=3.2)
_elements.swapAt(unbalancedIndex, parentIndex)
#else
swap(&_elements[unbalancedIndex], &_elements[parentIndex])
#endif
unbalancedIndex = parentIndex
}
}
@ -99,7 +106,11 @@ struct PriorityQueue<Element> {
guard highestPriorityIndex != unbalancedIndex else { break }
#if swift(>=3.2)
_elements.swapAt(highestPriorityIndex, unbalancedIndex)
#else
swap(&_elements[highestPriorityIndex], &_elements[unbalancedIndex])
#endif
unbalancedIndex = highestPriorityIndex
}
}

View File

@ -0,0 +1,43 @@
//
// DeprecationWarner.swift
// Platform
//
// Created by Shai Mishali on 1/9/18.
// Copyright © 2018 Krunoslav Zaher. All rights reserved.
//
import Foundation
#if DEBUG
class DeprecationWarner {
private static var warned = Set<Kind>()
private static var _lock = NSRecursiveLock()
static func warnIfNeeded(_ kind: Kind) {
_lock.lock(); defer { _lock.unlock() }
guard !warned.contains(kind) else { return }
warned.insert(kind)
print(" [DEPRECATED] \(kind.message)")
}
}
extension DeprecationWarner {
enum Kind {
case variable
case globalTestFunctionNext
case globalTestFunctionError
case globalTestFunctionCompleted
var message: String {
switch self {
case .variable: return "`Variable` is planned for future deprecation. Please consider `BehaviorRelay` as a replacement. Read more at: https://git.io/vNqvx"
case .globalTestFunctionNext: return "The `next()` global function is planned for future deprecation. Please use `Recorded.next()` instead."
case .globalTestFunctionError: return "The `error()` global function is planned for future deprecation. Please use `Recorded.error()` instead."
case .globalTestFunctionCompleted: return "The `completed()` global function is planned for future deprecation. Please use `Recorded.completed()` instead."
}
}
}
}
#endif