xcode swift print 디버그 모드일때만 동작하게 하기
2021. 3. 25. 07:58ㆍComputer/Apple Ecosystem Insights
Under what circumstances?
- Under Xcode 12.2
- With Swift5
How to do?
It's very simple way to be disable print function.
If you are developing using Swift, it doesn't matter which swift file. Please insert the code below. In my case, I inserted it at the top of the AppDelegate.
import UIKit
import CoreData
...
func print(_ items: Any...) {
#if DEBUG
Swift.print(items[0])
#endif
}
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
...
After insert codes, please change build scheme environment debug to release.
follow below image.
If you need print again, changed scheme to debug.
Conclusion
Override function is very useful when i develop application by swift
Stay Hunger, Stay Foolish
반응형
'Computer > Apple Ecosystem Insights' 카테고리의 다른 글
[SwiftUI] View Modifier: 개념부터 고급 사용법까지 (0) | 2024.09.19 |
---|---|
iOS Not found device (0) | 2022.12.25 |
Xcode 오류: failedToGetInstalledApplicationInfoAfterInstalling (0) | 2019.10.20 |
[Swift] Classes (0) | 2016.02.10 |
[Swift] Enumerations (0) | 2016.02.10 |