Use of 'print' refers to instance method rather than global function 'print(_:separator:terminator:)' in module 'Swift'

Why am I getting this error during code time in editor window of Xcode at every call to print function?

Use of 'print' refers to instance method rather than global function 'print(_:separator:terminator:)' in module 'Swift'

How do you call it? Do you have another print method in your own code?

We would need more context to answer. Maybe you have a library that overloads print.

You can silence it with Swift.print()

I believe you have a function called print() in some of your classes/structs and inside it you have some kind of print("Something...").

Xcode complains because it doesn't know which print function to call, the one you declared yourself or the native function for printing content.

If this is the case, then you can:

  • Rename your own print() function

or

  • Change print statement from print("Something") into Swift.print("Something")
Use of 'print' refers to instance method rather than global function 'print(_:separator:terminator:)' in module 'Swift'
 
 
Q