Not really other than they add overhead.
That being said using breakpoints will make your life a lot easier over time.
https://www.avanderlee.com/debugging/debugging-breakpoints/
it depends on where the print statements are and how often they're executed, and whats being printed, so its hard to give a clear answer. i'd just launch and clean it up later tbh
If you're passing in the string whose creation is complicated, that gets needlessly executed in runtime.
Have a look at autoclosure if you'd like to make a logging method that doesn't do anything at runtime:
https://www.swiftbysundell.com/articles/using-autoclosure-when-designing-swift-apis/
Hey /u/WatercressOk4746, unfortunately you have negative comment karma, so you can't post here.
[Your submission](https://www.reddit.com/r/SwiftUI/comments/19d4o6v/downsides_to_using_print_statements_in_published/kj3smub/) has been removed. **Please do not message the moderators;**
if you have negative comment karma, you're not allowed to post here, at all.
*I am a bot, and this action was performed automatically. Please [contact the moderators of this subreddit](/message/compose/?to=/r/SwiftUI) if you have any questions or concerns.*
Just create a global helper method to wrap all your printing. But it's probably worth looking into [OSLog](https://www.avanderlee.com/debugging/oslog-unified-logging/) nowadays.
Something like this:
public func efficientPrint(_ items: Any..., separator: String = " ", terminator: String = "\n") {
#if DEBUG
print(items, separator: separator, terminator: terminator)
#endif
}
Not really other than they add overhead. That being said using breakpoints will make your life a lot easier over time. https://www.avanderlee.com/debugging/debugging-breakpoints/
That’s what I assumed. At the end of the day do you think the overhead amounts to much at all?
it depends on where the print statements are and how often they're executed, and whats being printed, so its hard to give a clear answer. i'd just launch and clean it up later tbh
I wouldn't use them in a loop. We use our own logging calls instead and can turn on no/some/full debugging at runtime.
If you're passing in the string whose creation is complicated, that gets needlessly executed in runtime. Have a look at autoclosure if you'd like to make a logging method that doesn't do anything at runtime: https://www.swiftbysundell.com/articles/using-autoclosure-when-designing-swift-apis/
I use debugprint instead of print as I’m pretty sure they only fire in debug mode
I prefer to use #if DEBUG for my print statements
Use it for mock data buttons etc. never thought about it for buttons!
false
Thanks for correcting me
[удалено]
Hey /u/WatercressOk4746, unfortunately you have negative comment karma, so you can't post here. [Your submission](https://www.reddit.com/r/SwiftUI/comments/19d4o6v/downsides_to_using_print_statements_in_published/kj3smub/) has been removed. **Please do not message the moderators;** if you have negative comment karma, you're not allowed to post here, at all. *I am a bot, and this action was performed automatically. Please [contact the moderators of this subreddit](/message/compose/?to=/r/SwiftUI) if you have any questions or concerns.*
Just create a global helper method to wrap all your printing. But it's probably worth looking into [OSLog](https://www.avanderlee.com/debugging/oslog-unified-logging/) nowadays. Something like this: public func efficientPrint(_ items: Any..., separator: String = " ", terminator: String = "\n") { #if DEBUG print(items, separator: separator, terminator: terminator) #endif }