Skip to content

Commit

Permalink
feat: tabBar 넣기
Browse files Browse the repository at this point in the history
  • Loading branch information
jongnan committed Jul 18, 2024
1 parent 61a1445 commit 69e0a5e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public final class RecommendRouter: Router, RecommendRouting {
reactToMemeUseCase: reactToMemeUseCase,
bookmarkMemeUseCase: bookmarkMemeUseCase
)
)
).tabBar(selectedTab: selectedTab)

setRootView(recommendView)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import PPACModels
import PPACDomain
import PPACData
import PPACNetwork
import DesignSystem

public struct RecommendView: View {

Expand Down Expand Up @@ -91,6 +92,8 @@ public struct RecommendView: View {
.onReadSize { size in
zstackHeight = size.height
}

Spacer(minLength: 98)
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
.background(
Expand All @@ -103,6 +106,7 @@ public struct RecommendView: View {
endPoint: .bottom
)
)
.edgesIgnoringSafeArea(.bottom)
.onChange(of: currentMeme) {
if let currentMeme {
viewModel.dispatch(type: .showRecommendMeme(memeId: currentMeme.id))
Expand All @@ -112,6 +116,15 @@ public struct RecommendView: View {
}

#Preview {
var selectedTab: MainTab = .recommend

var selectedTabBinding: Binding<MainTab> {
Binding(
get: { selectedTab },
set: { selectedTab = $0 }
)
}

let networkService = NetworkService()
let memeRepository = MemeRepositoryImpl(networkservice: networkService)
let userRepository = UserRepositoryImpl(networkservice: networkService)
Expand All @@ -123,7 +136,6 @@ public struct RecommendView: View {
let reactToMemeUseCase = ReactToMemeUseCaseImpl(repository: memeRepository)
let bookmarkMemeUseCase = BookmarkMemeUseCaseImpl(repository: memeRepository)


return RecommendView(
RecommendViewModel(
router: nil,
Expand All @@ -134,4 +146,5 @@ public struct RecommendView: View {
bookmarkMemeUseCase: bookmarkMemeUseCase
)
)
.tabBar(selectedTab: selectedTabBinding)
}

0 comments on commit 69e0a5e

Please sign in to comment.