0

Update to address duplicate tag I don't believe this question is a duplicate because it asks about why removing the function calls is necessary and is not simply "how do I remove them". It does re-address removing the calls since Swift 2 has changed syntax and options...

I have seen many questions talking about how to remove print() commands from code for release version. My question is:

1.) Why is this necessary? Does print() slow things down enough to be significant?

2.) In this question, people offer different methods of "muting" the print command. Is there no way to disable this by editing the scheme of your build for release optimization?

I have attempted to override the print() function with my own to make it easy to comment out, but it is not being called. I have it outside of the app delegate class like an extension:

func print(object: Any) {
Swift.print(object)
}

Hoping someone can clarify a.) why I'm needing to do this, and b.) what I need to do to my code above to make it work in Swift 2.

Community
  • 1
  • 1
Charlie
  • 1,279
  • 2
  • 12
  • 28
  • 1
    See my revised answer here: http://stackoverflow.com/a/28157546/341994 – matt Oct 12 '15 at 19:56
  • Thanks Matt - appreciate you editing that. – Charlie Oct 12 '15 at 19:57
  • I did it just for you. – matt Oct 12 '15 at 19:57
  • The main reason for wanting to remove print statements from releases is that you would want to make sure you aren't exposing user data...for example, if you were printing out the values of a text field for the user's password, those values could be read in a debug log. – narner Oct 12 '15 at 19:59

0 Answers0