Skip to content

Instantly share code, notes, and snippets.

Created December 17, 2015 21:49
What would you like to do?
extension by retrofitting gist
let myString: String? = nil
protocol PossiblyEmpty {
var isEmpty: Bool { get }
extension String: PossiblyEmpty {}
extension Optional where Wrapped: PossiblyEmpty {
var isEmpty: Bool {
switch self {
case .None: return true
case .Some(let value): return value.isEmpty
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment