Indeed, NSView
has a
func print(_ sender: AnyObject?)
method to open the Print panel, which is an unfortunate conincidence.
Your myPrint()
wrapper has some limitations, for example
myPrint("b", appendNewline : false)
does not compile. A better implementation would be
func myPrint<T>(o : T, appendNewline nl: Bool = true) {
print(o, appendNewline: nl)
}
But you can simply prepend the module name “Swift” to refer to the global function explicitly:
Swift.print("xxx")