Skip to content

Instantly share code, notes, and snippets.

public struct NavigationSegue<FromViewControllerType: UINavigationController,
ToViewControllerType: UIViewController, ContextType>: SegueType {
public typealias E = ContextType
public typealias T = FromViewControllerType
public typealias U = ToViewControllerType
public weak var fromViewController: T?
public struct ModalSegue<FromViewControllerType: UIViewController,
ToViewControllerType: UIViewController, ContextType>: SegueType {
public typealias E = ContextType
public typealias T = FromViewControllerType
public typealias U = ToViewControllerType
public weak var fromViewController: T?
public let toViewControllerFactory: (sender: T, context: E) -> U
public let animated: Bool
public protocol SegueType: ObserverType {
/**
Type of the view controller from which navigation will appear
*/
typealias T
/**
Type of the target view controller
*/
typealias U
import PackageDescription
let package = Package(
name: "Test",
dependencies: [
.Package(url: "https://github.com/qutheory/vapor.git", majorVersion: 0)
],
exclude: [
"Public",
"Resources"
import RxSwift
import RxCocoa
class SomeTableViewController:UITableViewController {
let disposeBag = DisposeBag()
let items:[Item] ...
lazy var itemDetailsSegue:Segue<Item> = {
return Segue(fromViewController: self,
toViewControllerFactory: { context -> UIViewController in
import UIKit
import RxSwift
class Segue<T> {
private(set) weak var fromViewController:UIViewController?
let toViewControllerFactory:(context:T) -> UIViewController
init(fromViewController:UIViewController,
toViewControllerFactory:(context:T) -> UIViewController) {
import RxSwift
import Argo
struct HeroAPI {
private static let decodeScheduler = SerialDispatchQueueScheduler(internalSerialQueueName: "com.FunctionalMarvel.HeroAPI.decode_queue")
typealias HeroListResult = (heroes:Decoded<[Hero]>, batch:Decoded<Batch>)
private static func recursiveHeroList(offset:Int = 0,
limit:Int,
protocol JsonGET {
static func getData(endpoint:EndPoint)(parameters:[String: AnyObject]?) -> Observable<AnyObject>
}
struct Marvel {
//MARK:Private
private struct Keys {
static let privatKey = "9597bcd0e2339d5874d9913140b581ed0b55a921"
static let publicKey = "be23153c199affa766dc9fe6f34fd524"
protocol HeroAutoLoading {
static func getItems(offset:Int, limit:Int, loadNextBatch:Observable<Void>) -> Observable<[Hero]>
static func searchItems(offset:Int, limit:Int, search:String, loadNextBatch:Observable<Void>) -> Observable<[Hero]>
}
import RxSwift
extension UITableView {
var rxex_nextPageTriger:Observable<Void> {
return self
.rx_contentOffset
.flatMapLatest { [unowned self] (offset) -> Observable<Void> in
let shouldTriger = offset.y + self.frame.size.height + 40 > self.contentSize.height
return shouldTriger ? just() : empty()
}