Skip to content

Instantly share code, notes, and snippets.

@olivaresf
Created July 19, 2020 04:27
Show Gist options
  • Save olivaresf/a3e9d68bca665941b5fd8e3eb27c6db8 to your computer and use it in GitHub Desktop.
Save olivaresf/a3e9d68bca665941b5fd8e3eb27c6db8 to your computer and use it in GitHub Desktop.
A few actions...
// Behavior 1: Save to preferences.
class CurrencyPickerSettingsResponsible { }
extension CurrencyPickerSettingsResponsible : CurrencyPickerProtocol {
func selected(currency: String, from: CurrencyPickerTableViewController) {
let preferences = BTCPreferences.sharedPreferences()
preferences.setObject(key, forKey: kBTCSelectedCurrencyKey)
preferences.synchronize()
NSNotificationCenter.defaultCenter().postNotificationName(kBTCCurrencyDidChangeNotificationName, object: key)
from.navigationController?.popViewControllerAnimated(true)
}
}
// Behavior 2: No action.
class CurrencyPickerNoAction { }
extension CurrencyPickerSettingsResponsible : CurrencyPickerProtocol {
func selected(currency: String, from: CurrencyPickerTableViewController) { }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment