@@ -17,13 +17,13 @@ struct MainView: View {
1717 @State private var todayViewCoordinator : TodayViewCoordinator
1818 @State private var pushNotificationListViewCoordinator : PushNotificationListViewCoordinator
1919 @State private var profileViewCoordinator : ProfileViewCoordinator
20- @Binding var selectedTab : MainTab ?
20+ @Binding var selectedTab : MainTab
2121 private let windowEvent : TodoEditorWindowEvent
2222
2323 init (
2424 container: DIContainer ,
2525 windowEvent: TodoEditorWindowEvent ,
26- selectedTab: Binding < MainTab ? >
26+ selectedTab: Binding < MainTab >
2727 ) {
2828 self . _coordinator = State ( initialValue: MainViewCoordinator ( container: container) )
2929 self . _todoWindowCoordinator = State ( initialValue: TodoWindowCoordinator ( container: container) )
@@ -39,12 +39,10 @@ struct MainView: View {
3939
4040 var body : some View {
4141 Group {
42- if let selectedTab {
43- if isCompactLayout {
44- tabView
45- } else {
46- sidebarView ( for: selectedTab)
47- }
42+ if isCompactLayout {
43+ tabView
44+ } else {
45+ sidebarView ( for: selectedTab)
4846 }
4947 }
5048 . onAppear {
@@ -53,7 +51,6 @@ struct MainView: View {
5351 todoWindowCoordinator. bindWindowEvent ( windowEvent)
5452 }
5553 . onChange ( of: selectedTab, initial: true ) { _, newValue in
56- guard let newValue else { return }
5754 coordinator. viewModel. send ( . selectedTabChanged( newValue) )
5855 if newValue == . home {
5956 homeViewCoordinator. fetchData ( )
@@ -81,26 +78,26 @@ struct MainView: View {
8178 . tabItem {
8279 tabLabel ( . home)
8380 }
84- . tag ( MainTab . home as MainTab ? )
81+ . tag ( MainTab . home)
8582
8683 todayView
8784 . tabItem {
8885 tabLabel ( . today)
8986 }
90- . tag ( MainTab . today as MainTab ? )
87+ . tag ( MainTab . today)
9188
9289 notificationView
9390 . tabItem {
9491 tabLabel ( . notification)
9592 }
9693 . badge ( coordinator. viewModel. state. unreadPushCount)
97- . tag ( MainTab . notification as MainTab ? )
94+ . tag ( MainTab . notification)
9895
9996 profileView
10097 . tabItem {
10198 tabLabel ( . profile)
10299 }
103- . tag ( MainTab . profile as MainTab ? )
100+ . tag ( MainTab . profile)
104101 }
105102 }
106103
0 commit comments