Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feat/#5] 탭바 UI 생성 #7

Merged
merged 21 commits into from
Jan 26, 2025
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 35 additions & 7 deletions dorundorun/dorundorun.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
objects = {

/* Begin PBXBuildFile section */
14D7E642E63946C27FA539DE /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = AA95E43B40E215CF1F8B9304 /* Assets.xcassets */; };
179A084F2A528877C884F95C /* dorundorunApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = F690F5DE8513265C9CE21416 /* dorundorunApp.swift */; };
387D3C3B3CC2824201AD8F93 /* Pretendard-Bold.otf in Resources */ = {isa = PBXBuildFile; fileRef = 1C9BF0B471C0D91A7651182F /* Pretendard-Bold.otf */; };
48967D1F4ECBB1551E7590D8 /* Pretendard-Light.otf in Resources */ = {isa = PBXBuildFile; fileRef = 445FDCC89177CB17DC59ABBD /* Pretendard-Light.otf */; };
Expand All @@ -17,6 +16,14 @@
7ED3F8F0C2A527633323714E /* Pretendard-SemiBold.otf in Resources */ = {isa = PBXBuildFile; fileRef = 668F716FF175616D4B8C1EA9 /* Pretendard-SemiBold.otf */; };
863036F891814ADD79543A39 /* Pretendard-Medium.otf in Resources */ = {isa = PBXBuildFile; fileRef = A331EFDB52072D295754B1F2 /* Pretendard-Medium.otf */; };
AC4B7064FF253A4AE4FB9E93 /* Pretendard-Regular.otf in Resources */ = {isa = PBXBuildFile; fileRef = 3FB00500D04150D925C0A6F4 /* Pretendard-Regular.otf */; };
C3606C4F2D453ABE00A075A1 /* CustomTabView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3606C4E2D453ABE00A075A1 /* CustomTabView.swift */; };
C3606C512D453AF500A075A1 /* ButtonView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3606C502D453AF500A075A1 /* ButtonView.swift */; };
C3606C532D453E4300A075A1 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C3606C522D453E4300A075A1 /* Assets.xcassets */; };
C3F5DB202D4393E800605A18 /* TabbarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3F5DB1F2D4393E800605A18 /* TabbarView.swift */; };
C3F5DB222D43945700605A18 /* homeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3F5DB212D43945700605A18 /* homeView.swift */; };
C3F5DB242D43948800605A18 /* doodleRunView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3F5DB232D43948800605A18 /* doodleRunView.swift */; };
C3F5DB262D43949C00605A18 /* marketView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3F5DB252D43949C00605A18 /* marketView.swift */; };
C3F5DB282D4394AF00605A18 /* myPageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3F5DB272D4394AF00605A18 /* myPageView.swift */; };
D7907979253E279541E78415 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1D0A0A7E2B1973475B589A22 /* Preview Assets.xcassets */; };
E0551A8EFED2ABF50016CEE5 /* Icons.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1092B57F175DF2EC0F756430 /* Icons.xcassets */; };
E27BA6E02D3FB0F6007B54B0 /* Jalnan2.otf in Resources */ = {isa = PBXBuildFile; fileRef = E27BA6DF2D3FB0F6007B54B0 /* Jalnan2.otf */; };
Expand All @@ -41,8 +48,15 @@
77BA639E0011A273D9CCDA17 /* Pretendard-ExtraBold.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Pretendard-ExtraBold.otf"; sourceTree = "<group>"; };
9B54D871BBDE0FE1796A1460 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
A331EFDB52072D295754B1F2 /* Pretendard-Medium.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Pretendard-Medium.otf"; sourceTree = "<group>"; };
AA95E43B40E215CF1F8B9304 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
B4E4FD66878BCDD0D1E282B2 /* Pretendard-Black.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Pretendard-Black.otf"; sourceTree = "<group>"; };
C3606C4E2D453ABE00A075A1 /* CustomTabView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomTabView.swift; sourceTree = "<group>"; };
C3606C502D453AF500A075A1 /* ButtonView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ButtonView.swift; sourceTree = "<group>"; };
C3606C522D453E4300A075A1 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
C3F5DB1F2D4393E800605A18 /* TabbarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabbarView.swift; sourceTree = "<group>"; };
C3F5DB212D43945700605A18 /* homeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = homeView.swift; sourceTree = "<group>"; };
C3F5DB232D43948800605A18 /* doodleRunView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = doodleRunView.swift; sourceTree = "<group>"; };
C3F5DB252D43949C00605A18 /* marketView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = marketView.swift; sourceTree = "<group>"; };
C3F5DB272D4394AF00605A18 /* myPageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = myPageView.swift; sourceTree = "<group>"; };
D593C384C34403D08F9DF6F2 /* Pretendard-Thin.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Pretendard-Thin.otf"; sourceTree = "<group>"; };
E27BA6DF2D3FB0F6007B54B0 /* Jalnan2.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = Jalnan2.otf; sourceTree = "<group>"; };
E27BA6E52D3FB496007B54B0 /* Color+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Color+Extension.swift"; sourceTree = "<group>"; };
Expand All @@ -63,8 +77,8 @@
isa = PBXGroup;
children = (
E27BA6E42D3FB488007B54B0 /* Extension */,
39F80B4D13380475D8FB93FD /* App */,
55F5D06E8DF9721BB671A5DF /* DesignSystem */,
39F80B4D13380475D8FB93FD /* App */,
5DEF0DB554957D6F41DAB792 /* Presentaion */,
48E1EFB47D466708BE777860 /* Preview Content */,
);
Expand Down Expand Up @@ -92,7 +106,6 @@
isa = PBXGroup;
children = (
E27BA6E82D3FB560007B54B0 /* Components */,
AA95E43B40E215CF1F8B9304 /* Assets.xcassets */,
07E9E0E7584F7ACD69B84B64 /* Colors.xcassets */,
1092B57F175DF2EC0F756430 /* Icons.xcassets */,
849AE2F6A71AFAA45C6A8BCA /* Fonts */,
Expand All @@ -103,6 +116,13 @@
5DEF0DB554957D6F41DAB792 /* Presentaion */ = {
isa = PBXGroup;
children = (
C3F5DB1F2D4393E800605A18 /* TabbarView.swift */,
C3F5DB232D43948800605A18 /* doodleRunView.swift */,
C3F5DB212D43945700605A18 /* homeView.swift */,
C3F5DB252D43949C00605A18 /* marketView.swift */,
C3F5DB272D4394AF00605A18 /* myPageView.swift */,
C3606C4E2D453ABE00A075A1 /* CustomTabView.swift */,
C3606C502D453AF500A075A1 /* ButtonView.swift */,
4217CBD1D1E22A7F6731360F /* ContentView.swift */,
);
path = Presentaion;
Expand All @@ -113,6 +133,7 @@
children = (
E27BA6DC2D3FB0B5007B54B0 /* Jalnan2 */,
E27BA6DB2D3FB087007B54B0 /* Pretendard */,
C3606C522D453E4300A075A1 /* Assets.xcassets */,
);
path = Fonts;
sourceTree = "<group>";
Expand Down Expand Up @@ -218,11 +239,11 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
14D7E642E63946C27FA539DE /* Assets.xcassets in Resources */,
7793A74E729409FA1E0C3404 /* Colors.xcassets in Resources */,
E0551A8EFED2ABF50016CEE5 /* Icons.xcassets in Resources */,
593EA6E55F6150BBEB46BC7C /* Pretendard-Black.otf in Resources */,
387D3C3B3CC2824201AD8F93 /* Pretendard-Bold.otf in Resources */,
C3606C532D453E4300A075A1 /* Assets.xcassets in Resources */,
E7BD6D2B10F0319465ECFA40 /* Pretendard-ExtraBold.otf in Resources */,
7804B7E78ABADB9B8E808E19 /* Pretendard-ExtraLight.otf in Resources */,
48967D1F4ECBB1551E7590D8 /* Pretendard-Light.otf in Resources */,
Expand All @@ -242,10 +263,17 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
F4D2913937ADB672F9E299A4 /* ContentView.swift in Sources */,
179A084F2A528877C884F95C /* dorundorunApp.swift in Sources */,
E27BA6E62D3FB496007B54B0 /* Color+Extension.swift in Sources */,
E27BA6E92D3FB560007B54B0 /* RunningButton.swift in Sources */,
C3606C512D453AF500A075A1 /* ButtonView.swift in Sources */,
C3F5DB262D43949C00605A18 /* marketView.swift in Sources */,
F4D2913937ADB672F9E299A4 /* ContentView.swift in Sources */,
C3F5DB242D43948800605A18 /* doodleRunView.swift in Sources */,
C3F5DB222D43945700605A18 /* homeView.swift in Sources */,
C3F5DB282D4394AF00605A18 /* myPageView.swift in Sources */,
C3606C4F2D453ABE00A075A1 /* CustomTabView.swift in Sources */,
C3F5DB202D4393E800605A18 /* TabbarView.swift in Sources */,
179A084F2A528877C884F95C /* dorundorunApp.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
}
],
"info" : {
"author" : "xcode",
"version" : 1

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"colors" : [
{
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"images" : [
{
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "tinted"
}
],
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
cinnamonfor6214 marked this conversation as resolved.
Show resolved Hide resolved
31 changes: 31 additions & 0 deletions dorundorun/dorundorun/Presentaion/ButtonView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
//
// ButtonView.swift
// dorundorun
//
// Created by 박서현 on 1/26/25.
//

import SwiftUI

struct ButtonView: View {
let imageName: String
let title: String
let isSelected: Bool

var body: some View{
VStack{
cinnamonfor6214 marked this conversation as resolved.
Show resolved Hide resolved
Image(imageName)
.renderingMode(.template)
.foregroundStyle(isSelected ? Color.primary200 : Color.neutral500)
.padding(.vertical, 7)
Copy link
Contributor

@agseou agseou Jan 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

사소한 부분이지만, 여기 역시 피그마랑 레이아웃이 좀 달라요!
아이콘이랑 글자 사이 간격이 있잖아요 !

여기 패딩을 주고 싶다면....
아래에 패딩이 필요하니까...
저라면 .padding(.bottom, 9)로 둘 거 같아요 !
참고만 해주세요~

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이거 확인하면서 피그마에 있는 디자인이 살짝 대칭이 안맞는거 발견해서...
디자이너님께 요청해서 수정했어요!

패딩 확인하시면서 다시 한번 봐주세요!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@agseou 최대한 피그마 확인하면서 padding 넣고 수치 맞춰봤습니다...
번거로우시겠지만 re-request 요청 보낼테니 한 번만 확인 부탁드려요!
늘 감사합니다!

Text(title)
.font(.custom("SUIT", size: 10))
.foregroundStyle(isSelected ? Color.primary200 : Color.neutral600)
}
.offset(y: -15)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기에 offset을 둔 이유가 있을까요?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

눈으로 봤을 때 아이콘들이 너무 아래로 치우쳐진 것 같아서 넣어뒀었는데 코드 수정하다보니 전처럼 아예 아래로 치우치는 느낌이 없어져서 삭제했습니다!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

다시 보니까 프로토타입에 비해서는 확실히 아래로 치우치는 느낌이 있어서 padding을 넣었습니다
re-request 요청 보낼테니 한 번만 확인 부탁드려요...!!

Copy link
Contributor

@agseou agseou Jan 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

offset은 화면에 렌더링할 때만 이동시키는 역할을 해줘요
즉, 뷰의 원래 프레임은 변하지 않고, 화면에 보이는 위치만 이동하거등요!!

특히 버튼과 같은 아이들.. 상호작용이 있는 것들의
실제 뷰 레이아웃 위치를 변경하려면 offset보다는
padding, frame 등을 사용하는게 좋다고 생각합니다 !

}
}

#Preview {
ButtonView(imageName: "home-30", title: "홈", isSelected: true)
cinnamonfor6214 marked this conversation as resolved.
Show resolved Hide resolved
}
65 changes: 65 additions & 0 deletions dorundorun/dorundorun/Presentaion/CustomTabView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
//
// CustonTabView.swift
// dorundorun
//
// Created by 박서현 on 1/26/25.
//

import SwiftUI

struct CustomTabView: View {
@Binding var selectedTab: Tab

var body: some View{
VStack(spacing: 0){
Rectangle()
.frame(height: 3)
.foregroundStyle(Color.neutral100)

Spacer()
HStack{
Button(action: {selectedTab = .home}){
ButtonView(
imageName: "home-30",
title: "홈",
isSelected: selectedTab == .home
)
}

Spacer()
Button(action: {selectedTab = .doodleRun}){
ButtonView(
imageName: "run-30",
title: "두들런",
isSelected: selectedTab == .doodleRun
)
}

Spacer()
Button(action: {selectedTab = .market}){
ButtonView(
imageName: "store-30",
title: "마켓",
isSelected: selectedTab == .market
)
}

Spacer()
Button(action: {selectedTab = .myPage}){
ButtonView(
imageName: "mypage-30",
title: "마이",
isSelected: selectedTab == .myPage
)
}
}
.frame(width: 313, height: 51)
.padding(.vertical, 15)
}
.edgesIgnoringSafeArea(.bottom)
}
}

#Preview {
CustomTabView(selectedTab: .constant(.home))
}
Comment on lines +64 to +66
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

자꾸 오류가 나서 찾아보니 변수를 넘겨줄 떄 .constant를 쓰는 방법으로 하게 되었어요... 다른 방법이 있다면 알려주실 수 있을까욥? 🥹

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

지금 이 파일에서 @Binding 을 쓰고 있잖아요!
혹시 @Binding 이 필요한 이유에 대해 공유해주실 수 있나요?

43 changes: 43 additions & 0 deletions dorundorun/dorundorun/Presentaion/TabbarView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
//
// TabbarView.swift
// dorundorun
//
// Created by 박서현 on 1/24/25.
//

import SwiftUI

enum Tab {
case home
case doodleRun
case market
case myPage
}

struct TabbarView: View {

@State var seletedTab: Tab = .home

var body: some View {
VStack(spacing: 0){
switch seletedTab {
case .home:
homeView()
case .doodleRun:
doodleRunView()
case .market:
marketView()
case .myPage:
myPageView()
}
CustomTabView(selectedTab: $seletedTab)
.frame(height: 99)
.background(Color.neutralWhite)
}
.edgesIgnoringSafeArea(.bottom)
}
}

#Preview {
TabbarView()
}
19 changes: 19 additions & 0 deletions dorundorun/dorundorun/Presentaion/doodleRunView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// doodleRunView.swift
// dorundorun
//
// Created by 박서현 on 1/24/25.
//

import SwiftUI

struct doodleRunView: View {
var body: some View {
Text("두들런 화면")
.frame(maxWidth: .infinity, maxHeight: .infinity)
}
}

#Preview {
doodleRunView()
}
19 changes: 19 additions & 0 deletions dorundorun/dorundorun/Presentaion/homeView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// homeView.swift
// dorundorun
//
// Created by 박서현 on 1/24/25.
//

import SwiftUI

struct homeView: View {
var body: some View {
Text("홈 화면")
.frame(maxWidth: .infinity, maxHeight: .infinity)
}
}

#Preview {
homeView()
}
19 changes: 19 additions & 0 deletions dorundorun/dorundorun/Presentaion/marketView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// marketView.swift
// dorundorun
//
// Created by 박서현 on 1/24/25.
//

import SwiftUI

struct marketView: View {
var body: some View {
Text("마켓 화면")
.frame(maxWidth: .infinity, maxHeight: .infinity)
}
}

#Preview {
marketView()
}
19 changes: 19 additions & 0 deletions dorundorun/dorundorun/Presentaion/myPageView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// myPageView.swift
// dorundorun
//
// Created by 박서현 on 1/24/25.
//

import SwiftUI

struct myPageView: View {
var body: some View {
Text("마이페이지 화면")
.frame(maxWidth: .infinity, maxHeight: .infinity)
}
}

#Preview {
myPageView()
}