Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- Observable
- scrollview
- clean architecture
- swift documentation
- map
- 리펙토링
- uitableview
- tableView
- UITextView
- SWIFT
- ios
- Human interface guide
- 리팩토링
- Protocol
- UICollectionView
- ribs
- Clean Code
- MVVM
- swiftUI
- 애니메이션
- rxswift
- 클린 코드
- combine
- Xcode
- HIG
- RxCocoa
- 스위프트
- uiscrollview
- Refactoring
- collectionview
Archives
- Today
- Total
김종권의 iOS 앱 개발 알아가기
[iOS - Swift] 3. Build Setting 개념 - OTHER_SWIFT_FLAGS ($inherited, -Xfrontend -debug-time-function-bodies, -Xfrontend -warn-long-expression-type-checking) 본문
iOS 응용 (swift)
[iOS - Swift] 3. Build Setting 개념 - OTHER_SWIFT_FLAGS ($inherited, -Xfrontend -debug-time-function-bodies, -Xfrontend -warn-long-expression-type-checking)
jake-kim 2022. 12. 18. 22:26@Inherited
- 파일 구조 관계상으로 상위에 있는 세팅과 동일한 값으로 사용하겠다는 의미
ex) Target에서 $(inherited)를 사용하면 Config의 빌드 설정과 동일하게 적용

ex) Config 파일 생성하여, Config에서 특정 값을 설정하고 Target에서 $(inherited) 로 설정하면 config값과 동일한 세팅이 되는 예제

- 값 입력
APP_NAME = BuildSttingExample
- Config 파일 설정

- PROJECT를 보면 user-defined에 자동으로 생성

- TARGETS에도 자동으로 PROJECT와 같은 값을 갖지만, $(inheirted) 값을 입력해도, 상위와 동일한 BuildSttingExample로 지정됨을 확인

OTHER_SWIFT_FLAGS
- 전처리기 flag를 의미 (소스코드 작성 및 컴파일을 하기 전에 하는 작업)
- Xcode > Build Settings > OTHER_SWIFT_FLAGS에서 값 설정
- -D라는 prefix를 붙여서 적용

- #if 키워드로 사용
#if HELLO_DEBUG
print("HELLO_DEBUG")
#else
print("NOT")
#endif
// HELLO_DEBUG
-Xfrontend -debug-time-function-bodies와 -Xfrontend -debug-time-expression-type-checking
- -Xfrontend -debug-time-function-bodies
- 해당 값을 사용하여 전처리 시, 함수의 실행 시간에 대한 정보를 출력해주는 플래그

아래와같이 정보를 출력

- -Xfrontend -warn-long-expression-type-checking=500
- 해당 값을 사용하여 전처리 시, 타입이 체크되는 시간을 확인하여, 입력한 ms 시간이 지나는게 있으면 Warning 메시지를 표출
- 위 두 세팅 모두 OTHER_SWIFT_FLAGS에 입력 (둘 다 0.5초를 임계값으로 설정)
-Xfrontend -warn-long-expression-type-checking=500
-Xfrontend -debug-time-function-bodies

- 입력 완료

* 이 밖의 더 다양한 플래그는 여기 참고
* 전체 코드: https://github.com/JK0369/ExOtherFlags
* 참고
https://github.com/apple/swift/blob/main/docs/CompilerPerformance.md#diagnostic-options
https://github.com/apple/swift/commit/18c75928639acf0ccf0e1fb6729eea75bc09cbd5