Created
February 5, 2015 00:49
-
-
Save keithnorm/7912d5fe2e305e74ed72 to your computer and use it in GitHub Desktop.
observable pattern pseudo code in swift
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
class ViewController { | |
var observable<[String]> | |
public var viewModel: ViewModel? { | |
didSet { | |
self.observable = Observable(viewModel?.someProperty) | |
self.observable.bind { [unowned self] (someProperty) in | |
if let dataSource = self.dataSource { | |
dataSource.someProperty = someProperty | |
} | |
} | |
} | |
} | |
} | |
class ViewModel { | |
var someProperty = [String]() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment