[Feat/#417] UIkit -> SwiftUI 마이그레이션 #418
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🔗 연결된 이슈
📄 작업 내용
💻 주요 코드 설명
RxSwift와 SwiftUI의 데이터 바인딩 통합
문제점: RxSwift BehaviorRelay vs SwiftUI @ObservedObject
기존 UIKit + RxSwift 코드
문제 상황
SwiftUI의 @ObservedObject는 Combine의 ObservableObject 프로토콜을 준수해야
하는데, RxSwift의 BehaviorRelay는 준수안함 (당연함)
해결책: Wrapper 패턴으로 브리징
[ObservableObject](https://developer.apple.com/documentation/combine/observableobject) 를 써서 Wrapper 클래스로 해결핑
UIHostingController 통합
문제점: 네비게이션 구조 유지
https://developer.apple.com/documentation/swiftui/uihostingcontroller
1. 전체 교체 (했다가 실패함ㅠ)
문제는 BaseViewController의 기능 상실, 네비게이션 바 커스터마이징 어려워지게 되더라구요
해서 안되니까 Child View Controller 채택
문제점: fillEqually Distribution 구현
https://developer.apple.com/documentation/swiftui/geometryreader
기존코드
GeometryReader로 바로 정상
네비게이션 로직은 UIkit이 뷰만 SwiftUI에서
SwiftUI에서 UIKit ViewController Push를 유지해야 하는 상황 [참고](https://developer.apple.com/documentation/swiftui/uiviewcontrollerrepresentable)
네비게이션 로직: UIKit (UINavigationController, push/pop 등)
구체적인 구조
Equatable 프로토콜 추가
문제점: [onChange](https://developer.apple.com/documentation/swiftui/view/onchange(of:perform:)) 모디파이어 사용 시 필요
👀 기타 더 이야기해볼 점
마이그레이션은 하나씩 천천히 해야겟어요 간단한뷰라 쉬울줄알앗는데 개헷갈림;;