Last active
August 3, 2017 21:16
-
-
Save jarsen/609927aca9890b294cb6 to your computer and use it in GitHub Desktop.
conform to this protocol and get a debugPrint for free
This file contains hidden or 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
protocol Debuggable { | |
var debug: Bool { get set } | |
func debugPrint(message: String) | |
} | |
extension Debuggable { | |
func debugPrint(message: String) { | |
if debug { | |
print(message) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment