问题
I know that I can just change names, but is there another way to solve this?
class MyClass{
func print(_ string: String) {
// I'm trying to call a native print method.
// Results in error, because it's trying to do recursion.
print(string, terminator: ";")
}
}
回答1:
For global Swift builtins you can call Swift.whatever(argument), so in this case:
Swift.print(string, terminator: ";")
来源:https://stackoverflow.com/questions/42559175/swift-how-to-call-non-class-function-if-i-have-the-same-function-in-my-class