-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: 기본 탭 추가 (#13) * feat: tabItem 파라미터 수정 (#13) feat: tab 기본 화면들 background color 추가(#13) * feat: mainTab과 view 파일 분리 (#13) * feat: 코드리뷰 반영 - 부분 cornerRadius 함수 clipShape로 변경 * feat: feature 프로젝트 생성 후 파일 이동 (#13) * etc: dummy 파일 삭제 (#13) * feat: 코드리뷰 반영 - color값 사용 방식 변경 및 indent 수정(#13) * etc: 잘못 들어간 모듈 삭제 (#13) * feat: TabBarView 컴포넌트 stack 정리
- Loading branch information
Showing
16 changed files
with
300 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// | ||
// MainTab.swift | ||
// DesignSystem | ||
// | ||
// Created by 장혜령 on 6/17/24. | ||
// | ||
|
||
import SwiftUI | ||
import Recommend | ||
import Search | ||
import MyPage | ||
|
||
enum MainTab: String, CaseIterable, Identifiable { | ||
case recommend | ||
case search | ||
case mypage | ||
|
||
var id: String { rawValue } | ||
|
||
var image: String { | ||
switch self { | ||
case .recommend: | ||
return "1.square.fill" | ||
case .search: | ||
return "2.square.fill" | ||
case .mypage: | ||
return "3.square.fill" | ||
} | ||
} | ||
|
||
var selectedImage: String { | ||
switch self { | ||
case .recommend: | ||
return "1.square" | ||
case .search: | ||
return "2.square" | ||
case .mypage: | ||
return "3.square" | ||
} | ||
} | ||
|
||
var title: String { | ||
switch self { | ||
case .recommend: | ||
return "추천" | ||
case .search: | ||
return "검색" | ||
case .mypage: | ||
return "마이" | ||
} | ||
} | ||
|
||
} |
83 changes: 83 additions & 0 deletions
83
Projects/Features/Home/Sources/View/MainTab/MainTabView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
// | ||
// MainTabView.swift | ||
// DesignSystem | ||
// | ||
// Created by 장혜령 on 6/16/24. | ||
// | ||
|
||
import SwiftUI | ||
import Recommend | ||
import Search | ||
import MyPage | ||
|
||
public struct MainTabView: View { | ||
@State private var selectedTab: MainTab = .recommend | ||
|
||
public init() {} | ||
|
||
public var body: some View { | ||
ZStack { | ||
TabView(selection: $selectedTab) { | ||
RecommendView() | ||
.tag(MainTab.recommend) | ||
SearchView() | ||
.tag(MainTab.search) | ||
MyPageView() | ||
.tag(MainTab.mypage) | ||
} | ||
VStack { | ||
Spacer() | ||
CustomTabBarView(selectedTab: $selectedTab) | ||
} | ||
} | ||
.edgesIgnoringSafeArea(.bottom) | ||
} | ||
} | ||
|
||
struct CustomTabBarView: View { | ||
@Binding var selectedTab: MainTab | ||
|
||
var body: some View { | ||
VStack { | ||
HStack { | ||
ForEach(MainTab.allCases) { tab in | ||
TabItemView(tab: tab, isSelected: selectedTab == tab) | ||
.onTapGesture { | ||
selectedTab = tab | ||
} | ||
} | ||
} | ||
Spacer(minLength: 20) | ||
} | ||
.frame(maxWidth: .infinity, maxHeight: 98) | ||
.background(.white) | ||
.clipShape( | ||
.rect( | ||
topLeadingRadius: 30, | ||
topTrailingRadius: 30 | ||
) | ||
) | ||
} | ||
} | ||
|
||
|
||
struct TabItemView: View { | ||
|
||
let tab: MainTab | ||
let isSelected: Bool | ||
|
||
var body: some View { | ||
VStack { | ||
Image(systemName: isSelected ? tab.selectedImage : tab.image) | ||
.frame(width: 20, height: 20) | ||
Text(tab.title) | ||
.font(.system(size: 11)) | ||
} | ||
.padding(40) | ||
} | ||
} | ||
|
||
|
||
#Preview { | ||
MainTabView() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// | ||
// Project.swift | ||
// MyPage | ||
// | ||
// Created by hyeryeong on 6/18/24 | ||
// | ||
|
||
import ProjectDescription | ||
import ProjectDescriptionHelpers | ||
|
||
let project = Project( | ||
name: "MyPage", | ||
targets: [ | ||
.configure( | ||
name: "MyPage", | ||
product: .framework, | ||
infoPlist: .default, | ||
sources: "Sources/**", | ||
resources: "Resources/**", | ||
dependencies: [ | ||
|
||
] | ||
) | ||
] | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
더미임미다 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// | ||
// MyPageView.swift | ||
// DesignSystem | ||
// | ||
// Created by 장혜령 on 6/16/24. | ||
// | ||
|
||
import SwiftUI | ||
|
||
public struct MyPageView: View { | ||
public init() { } | ||
|
||
public var body: some View { | ||
Text("마이페이지 화면") | ||
.frame(maxWidth: .infinity, maxHeight: .infinity) | ||
.background(.blue) | ||
} | ||
} | ||
|
||
#Preview { | ||
MyPageView() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// | ||
// Project.swift | ||
// Recommend | ||
// | ||
// Created by hyeryeong on 6/18/24 | ||
// | ||
|
||
import ProjectDescription | ||
import ProjectDescriptionHelpers | ||
|
||
let project = Project( | ||
name: "Recommend", | ||
targets: [ | ||
.configure( | ||
name: "Recommend", | ||
product: .framework, | ||
infoPlist: .default, | ||
sources: "Sources/**", | ||
resources: "Resources/**", | ||
dependencies: [ | ||
|
||
] | ||
) | ||
] | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
더미임미다 |
24 changes: 24 additions & 0 deletions
24
Projects/Features/Recommend/Sources/View/RecommendView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// | ||
// RecommendView.swift | ||
// Home | ||
// | ||
// Created by 장혜령 on 6/16/24. | ||
// | ||
|
||
import SwiftUI | ||
|
||
public struct RecommendView: View { | ||
public init() { } | ||
|
||
public var body: some View { | ||
VStack { | ||
Text("추천 화면") | ||
} | ||
.frame(maxWidth: .infinity, maxHeight: .infinity) | ||
.background(.yellow) | ||
} | ||
} | ||
|
||
#Preview { | ||
RecommendView() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// | ||
// Project.swift | ||
// Search | ||
// | ||
// Created by hyeryeong on 6/18/24 | ||
// | ||
|
||
import ProjectDescription | ||
import ProjectDescriptionHelpers | ||
|
||
let project = Project( | ||
name: "Search", | ||
targets: [ | ||
.configure( | ||
name: "Search", | ||
product: .framework, | ||
infoPlist: .default, | ||
sources: "Sources/**", | ||
resources: "Resources/**", | ||
dependencies: [ | ||
|
||
] | ||
) | ||
] | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
더미임미다 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// | ||
// SearchView.swift | ||
// DesignSystem | ||
// | ||
// Created by 장혜령 on 6/16/24. | ||
// | ||
|
||
import SwiftUI | ||
|
||
public struct SearchView: View { | ||
public init() { } | ||
|
||
public var body: some View { | ||
Text("검색 화면") | ||
.frame(maxWidth: .infinity, maxHeight: .infinity) | ||
.background(.pink) | ||
} | ||
} | ||
|
||
#Preview { | ||
SearchView() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters