Skip to content

Instantly share code, notes, and snippets.

@dagronf
Created February 17, 2020 06:36
Show Gist options
  • Save dagronf/6ba845cf8fb97284540bef1c96ba3583 to your computer and use it in GitHub Desktop.
Save dagronf/6ba845cf8fb97284540bef1c96ba3583 to your computer and use it in GitHub Desktop.
NSControl.StateValue extension for CustomStringConvertible
extension NSControl.StateValue: CustomStringConvertible {
public var description: String {
switch self {
case .on: return NSLocalizedString("On", comment: "State for when a control is 'on'")
case .mixed: return NSLocalizedString("Mixed", comment: "State for when a control is neither on of off")
case .off: return NSLocalizedString("Off", comment: "State for when a control is 'off'")
default: fatalError("unimplemented state")
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment