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 | 31 |
Tags
- 애니메이션
- rxswift
- scrollview
- Human interface guide
- clean architecture
- MVVM
- UICollectionView
- Protocol
- 스위프트
- 리펙토링
- RxCocoa
- swiftUI
- Observable
- collectionview
- ribs
- combine
- ios
- 클린 코드
- Clean Code
- 리팩토링
- HIG
- Xcode
- UITextView
- map
- SWIFT
- tableView
- Refactoring
- uitableview
- uiscrollview
- swift documentation
Archives
- Today
- Total
김종권의 iOS 앱 개발 알아가기
[iOS - swift] deprecated 알림 표시 방법 @available(*, deprecated, message:), @available(*, deprecated, renamed:, message:) 본문
iOS 응용 (swift)
[iOS - swift] deprecated 알림 표시 방법 @available(*, deprecated, message:), @available(*, deprecated, renamed:, message:)
jake-kim 2023. 11. 20. 01:54deprecated 알림 표시
- 특정 메서드가 리펙터링 되거나 버전이 증가한 경우, 기존 메서드 사용을 지양시키고 싶은 경우?
- @avaialbe(*, deprecated)를 사용
a() 메서드를 deprecated 알림을 주고, b() 메서드를 실행시키고 싶은 경우?
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
a()
}
func a() {
}
func b() {
}
}
- @available(*, deprecated, message:) 키워드를 사용
@available(*, deprecated, message: "b()를 사용해주세요.")
func a() {
}

- 만약 이름만 변경된 메서드가 있다면, renamed가 추가된 @available(*, deprecated, renamed:, message:) 를 사용
- 이것을 사용하면 Use 'b' instead 처럼 개발자에게 'Fix' 버튼도 제공

(Fix 버튼 클릭 시, renamed에 적어놓은 문자열로 replace되어 편리한 기능까지 제공)

'iOS 응용 (swift)' 카테고리의 다른 글
Comments
