This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// RxActivity.swift | |
// Uniview | |
// | |
// Created by Krunoslav Zaher on 10/18/15. | |
// Borrowed and revised by David James | |
// Original source found in the open source project RxSwift. | |
// Copyright © 2015 Krunoslav Zaher. All rights reserved. | |
// |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Wrapper to perform pattern matching via closure. | |
/// Author: Olivier Halligon | |
public struct Matcher<T> { | |
public let closure: (T) -> Bool | |
public static func ~= (lhs: Matcher<T>, rhs: T) -> Bool { | |
return lhs.closure(rhs) | |
} | |
} | |
/// Perform a pattern match via closure. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Code via Olivier Halligon and Nate Cook | |
struct ContainmentMatcher<T: Hashable> { | |
let set: Set<T> | |
static func ~=(lhs: ContainmentMatcher<T>, rhs: Set<T>) -> Bool { | |
return rhs.isSuperset(of: lhs.set) | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Set-like functionality on Arrays Equatable elements. | |
/// Performance on these is O(n) | |
public extension Array where Element : Equatable { | |
func removingDuplicates() -> Array<Iterator.Element> { | |
var newArray = [Element]() | |
for element in self { | |
newArray.formUnion(element) | |
} | |
return newArray |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public protocol Transformable : class { | |
func scaled(x:CGFloat, y:CGFloat, z:CGFloat?) | |
func rotated(_ radians:CGFloat, x:CGFloat?, y:CGFloat?, z:CGFloat?) | |
func translated(x:CGFloat, y:CGFloat, z:CGFloat?) | |
func resetScale() | |
func resetRotation() | |
func resetTranslation() | |
func resetAllTransforms() | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public struct ck_SaveRecordsCommand : ObservableTask { | |
public typealias Element = [CKRecord] | |
public var records:Element | |
public var options:TaskOptions? | |
public let cloudOptions:ck_Options | |
private var dependency:LoginDependency? | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// RxActivity.swift | |
// Uniview | |
// | |
// Created by Krunoslav Zaher on 10/18/15. | |
// Borrowed and revised by David James | |
// Original source found in the open source project RxSwift. | |
// Copyright © 2015 Krunoslav Zaher. All rights reserved. | |
// |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Colors.swift | |
// Uniview | |
// | |
// Created by David James on 10/13/16. | |
// Copyright © 2016 David B James. All rights reserved. | |
// | |
import UIKit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The API | |
func getPeople() -> Observable<[Person]> { | |
return Observable.create { (observer: AnyObserver<[Person]>) -> Disposable in | |
self.getPeople({ (people) in | |
guard people != nil else { | |
return |