커스텀한 탭바를 만드는 방법엔 다양한 방법들이 있습니다!
PreferenceKey를 이용해서 자식의 뷰가 업데이트 될 때, 부모의 뷰가 이 것을 알아차리고 스스로를 업뎃할 수 있게 구성해줄 수도 있고
아니면 오늘 만들어볼 SwiftUI의 기본 TabView 컴포넌트랑 함께 커스텀하게 만든 뷰를 위에 올려서 구성해줄 수도 있어요!
| ⭐ Total Stars: 1 | |
| ➕ Total Commits: 860 | |
| 🔀 Total PRs: 3 | |
| 🚩 Total Issues: 1 | |
| 📦 Contributed to: 1 |
| 🌞 Morning 41 commits ██▏░░░░░░░░░░░░░░░░░░ 10.5% | |
| 🌆 Daytime 116 commits ██████▎░░░░░░░░░░░░░░ 29.8% | |
| 🌃 Evening 166 commits ████████▉░░░░░░░░░░░░ 42.7% | |
| 🌙 Night 66 commits ███▌░░░░░░░░░░░░░░░░░ 17.0% |
https://developer.apple.com/tutorials/app-dev-training/handling-errors
https://www.youtube.com/watch?v=ss50RX7F7nE&list=PLwvDm4Vfkdphr2Dl4sY4rS9PLzPdyi8PM&index=2
class BusManager {
let isActive: Bool = false
https://developer.apple.com/wwdc21/10019 https://developer.apple.com/wwdc21/10132 https://www.youtube.com/watch?v=9fXI6o39jLQ&list=PLwvDm4Vfkdphr2Dl4sY4rS9PLzPdyi8PM&index=3 https://www.kodeco.com/books/modern-concurrency-in-swift/v1.0/chapters/1-why-modern-swift-concurrency#toc-chapter-007-anchor-001
먼저 completion으로 구현을 해볼까요!
class CityBusManager {간단한 포스트를 추가하는 기능을 구현해 볼거에요. 기능을 구현하면서 State Binding ObservedObject StateObject EnvironmentObject까지 다 한번씩 써보겠습니다.
먼저 포스트 모델이랑 mock list 구성해주고
struct Post: Identifiable {
let id = UUID()
let username: String
import SwiftUI
class CustomUITextField: UITextField {
override func canPerformAction(_ action: Selector, withSender sender: Any?) -> Bool {
if action == #selector(UIResponderStandardEditActions.paste(_:)) || action == #selector(UIResponderStandardEditActions.copy(_:)) || action == #selector(UIResponderStandardEditActions.cut(_:)) {
return false
}
return super.canPerformAction(action, withSender: sender)
}