Skip to content

Commit

Permalink
Merge pull request #63 from Nexters/refactor/tab-bar
Browse files Browse the repository at this point in the history
탭바 커스텀
  • Loading branch information
enebin authored Aug 17, 2023
2 parents c27c65f + 1de8695 commit 647be99
Show file tree
Hide file tree
Showing 23 changed files with 149 additions and 54 deletions.
5 changes: 4 additions & 1 deletion Projects/Core/Util/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,8 @@ import ProjectDescription
import ProjectDescriptionHelpers

let project = Project.makeModule(
name: "Util"
name: "Util",
externalDependencies: [
.external(name: "Kingfisher")
]
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "home-2-1.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "home-2.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "user-1.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "user.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 35 additions & 8 deletions Projects/Features/Sources/MainPage/MainPageView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,39 +8,48 @@

import SwiftUI
import SwiftUIIntrospect
import DSKit
import ComposableArchitecture

struct KeymeMainView: View {
@State private var selectedTab = 1
@State private var selectedTab: Tab = .home

private var myPageStore = Store(initialState: MyPageFeature.State()) {
MyPageFeature()
}

enum Tab: Int {
case home, myPage
}

var body: some View {
TabView(selection: $selectedTab) {
TestView(store: Store(
initialState: TestStore.State(),
reducer: TestStore()))
.tabItem {
Image(systemName: "1.square.fill")
Text("Home")
homeTabImage
.resizable()
.frame(width: 24, height: 24)
.aspectRatio(contentMode: .fit)
}
.tag(0)
.tag(Tab.home)

MyPageView(store: myPageStore)
.tabItem {
Image(systemName: "2.square.fill")
Text("My page")
myPageTabImage
.resizable()
.frame(width: 24, height: 24)
.aspectRatio(contentMode: .fit)
}
.tag(1)
.tag(Tab.myPage)
}
.introspect(.tabView, on: .iOS(.v16, .v17)) { tabViewController in
let tabBar = tabViewController.tabBar

let barAppearance = UITabBarAppearance()
barAppearance.configureWithOpaqueBackground()
barAppearance.backgroundColor = .black
barAppearance.backgroundColor = UIColor(Color.hex("232323"))

let itemAppearance = UITabBarItemAppearance()
itemAppearance.selected.iconColor = .white
Expand All @@ -57,6 +66,24 @@ struct KeymeMainView: View {
}
}

private extension KeymeMainView {
var homeTabImage: Image {
if selectedTab == .home {
return DSKitAsset.Image.homeSelected.swiftUIImage
} else {
return DSKitAsset.Image.home.swiftUIImage
}
}

var myPageTabImage: Image {
if selectedTab == .myPage {
return DSKitAsset.Image.userSelected.swiftUIImage
} else {
return DSKitAsset.Image.user.swiftUIImage
}
}
}

struct KeymeTabView_Previews: PreviewProvider {
static var previews: some View {
KeymeMainView()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,7 @@ private extension CirclePackView {
print("Tapped")
}) {
VStack {
Text("내 성격 더보기")
.font(.Keyme.body3Semibold)
Text.keyme("내 성격 더보기", font: .body3Semibold)

UpArrowButton()
.frame(width: 24, height: 24)
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,91 +1,73 @@
{
"images" : [
{
"filename" : "40.png",
"idiom" : "iphone",
"scale" : "2x",
"size" : "20x20"
},
{
"filename" : "60.png",
"idiom" : "iphone",
"scale" : "3x",
"size" : "20x20"
},
{
"filename" : "29.png",
"idiom" : "iphone",
"scale" : "1x",
"size" : "29x29"
},
{
"filename" : "58.png",
"idiom" : "iphone",
"scale" : "2x",
"size" : "29x29"
},
{
"filename" : "87.png",
"idiom" : "iphone",
"scale" : "3x",
"size" : "29x29"
},
{
"filename" : "80.png",
"idiom" : "iphone",
"scale" : "2x",
"size" : "40x40"
},
{
"filename" : "120.png",
"idiom" : "iphone",
"scale" : "3x",
"size" : "40x40"
},
{
"filename" : "57.png",
"idiom" : "iphone",
"scale" : "2x",
"size" : "60x60"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "60x60"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "20x20"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "20x20"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "29x29"
"size" : "57x57"
},
{
"idiom" : "ipad",
"filename" : "114.png",
"idiom" : "iphone",
"scale" : "2x",
"size" : "29x29"
"size" : "57x57"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "40x40"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "40x40"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "76x76"
},
{
"idiom" : "ipad",
"filename" : "120.png",
"idiom" : "iphone",
"scale" : "2x",
"size" : "76x76"
"size" : "60x60"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "83.5x83.5"
"filename" : "180.png",
"idiom" : "iphone",
"scale" : "3x",
"size" : "60x60"
},
{
"filename" : "1024.png",
"idiom" : "ios-marketing",
"scale" : "1x",
"size" : "1024x1024"
Expand Down

0 comments on commit 647be99

Please sign in to comment.