If you are anything like me, you were not very pleased with the print()
and println()
changes. While working on some other items, I realized that it's possible to shadow global functions with your own. This means that we can fix the print()
and println()
functions. Yay!
func print<T>(value: T, appendNewline: Bool = false) {
Swift.print(value, appendNewline: false)
}
func print<T, TargetStream : OutputStreamType>(value: T, inout _ target: TargetStream, appendNewline: Bool = false) {
Swift.print(value, &target, appendNewline: false)
}
func println<T>(value: T, appendNewline: Bool = true) {
Swift.print(value, appendNewline: true)
}
func println<T, TargetStream : OutputStreamType>(value: T, inout _ target: TargetStream, appendNewline: Bool = true) {
Swift.print(value, &target, appendNewline: true)
}
Agh! Back to sanity (at least for me).
P.S.
- I logged a bug about the behavior here: http://openradar.appspot.com/21577485.
- Full source for the above workaround can be found here: swift-fix.