Last active
November 28, 2016 18:48
-
-
Save hannesstruss/520eee7ae806323e1c0ebc3f8ac7f383 to your computer and use it in GitHub Desktop.
This file contains 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
//: Playground - noun: a place where people can play | |
import UIKit | |
import RxSwift | |
protocol ListSource { | |
associatedtype ItemT | |
func getItems(index: Int) -> [ItemT] | |
} | |
class ActualSource: ListSource { | |
typealias ItemT = String | |
func getItems(index: Int) -> [String] { | |
return ["Hallo", "Na"] | |
} | |
} | |
let l: Array<String> | |
class Storage<T, ListSourceT: ListSource> where ListSourceT.ItemT == T { | |
let ls: ListSourceT | |
init(_ listSource: ListSourceT) { | |
ls = listSource | |
let items: [T] = ls.getItems(index: 2) | |
print(items.count) | |
} | |
} | |
let actualSource = ActualSource() | |
let stringStorage = Storage(actualSource) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment