From 20d692e426c6a1e70c6a2e9426ab534fd39e2baa Mon Sep 17 00:00:00 2001 From: gyaroron Date: Tue, 20 Aug 2024 19:07:01 +0900 Subject: [PATCH] AddTabBar --- CCB_USG_2024.xcodeproj/project.pbxproj | 12 +++++++++ .../Assets.xcassets/Symbols/Contents.json | 6 +++++ .../Symbols/bell.imageset/Contents.json | 21 +++++++++++++++ .../Symbols/bell.imageset/bell.png | Bin 0 -> 574 bytes .../Symbols/bookmark.imageset/Contents.json | 21 +++++++++++++++ .../Symbols/bookmark.imageset/bookmark.png | Bin 0 -> 411 bytes .../Symbols/ellipsis.imageset/Contents.json | 21 +++++++++++++++ .../Symbols/ellipsis.imageset/ellipsis.png | Bin 0 -> 292 bytes .../magnifyingglass.imageset/Contents.json | 21 +++++++++++++++ .../magnifyingglass.png | Bin 0 -> 585 bytes CCB_USG_2024/CCB_USG_2024App.swift | 2 +- CCB_USG_2024/TabBarIcon.swift | 16 ++++++++++++ CCB_USG_2024/TabBarView.swift | 24 ++++++++++++++++++ CCB_USG_2024/TabBarViewModel.swift | 21 +++++++++++++++ 14 files changed, 164 insertions(+), 1 deletion(-) create mode 100644 CCB_USG_2024/Assets.xcassets/Symbols/Contents.json create mode 100644 CCB_USG_2024/Assets.xcassets/Symbols/bell.imageset/Contents.json create mode 100644 CCB_USG_2024/Assets.xcassets/Symbols/bell.imageset/bell.png create mode 100644 CCB_USG_2024/Assets.xcassets/Symbols/bookmark.imageset/Contents.json create mode 100644 CCB_USG_2024/Assets.xcassets/Symbols/bookmark.imageset/bookmark.png create mode 100644 CCB_USG_2024/Assets.xcassets/Symbols/ellipsis.imageset/Contents.json create mode 100644 CCB_USG_2024/Assets.xcassets/Symbols/ellipsis.imageset/ellipsis.png create mode 100644 CCB_USG_2024/Assets.xcassets/Symbols/magnifyingglass.imageset/Contents.json create mode 100644 CCB_USG_2024/Assets.xcassets/Symbols/magnifyingglass.imageset/magnifyingglass.png create mode 100644 CCB_USG_2024/TabBarIcon.swift create mode 100644 CCB_USG_2024/TabBarView.swift create mode 100644 CCB_USG_2024/TabBarViewModel.swift diff --git a/CCB_USG_2024.xcodeproj/project.pbxproj b/CCB_USG_2024.xcodeproj/project.pbxproj index c745c8e..09a862a 100644 --- a/CCB_USG_2024.xcodeproj/project.pbxproj +++ b/CCB_USG_2024.xcodeproj/project.pbxproj @@ -12,6 +12,9 @@ 103DFA902C660F0B00B7E00C /* PostManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 103DFA8F2C660F0B00B7E00C /* PostManager.swift */; }; 103DFA9A2C6AF3D900B7E00C /* JsonParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 103DFA992C6AF3D900B7E00C /* JsonParser.swift */; }; 103DFAA02C6AF46000B7E00C /* MockPost.json in Resources */ = {isa = PBXBuildFile; fileRef = 103DFA9E2C6AF46000B7E00C /* MockPost.json */; }; + 3A3AD4CB2C747CAA00F2EB2F /* TabBarIcon.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A3AD4CA2C747CAA00F2EB2F /* TabBarIcon.swift */; }; + 3A3AD4CD2C747E7A00F2EB2F /* TabBarViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A3AD4CC2C747E7A00F2EB2F /* TabBarViewModel.swift */; }; + 3A3AD4CF2C74870000F2EB2F /* TabBarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A3AD4CE2C74870000F2EB2F /* TabBarView.swift */; }; 3A9FD58B2C6304860016F5B6 /* CCB_USG_2024App.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A9FD58A2C6304860016F5B6 /* CCB_USG_2024App.swift */; }; 3A9FD58D2C6304860016F5B6 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A9FD58C2C6304860016F5B6 /* ContentView.swift */; }; 3A9FD58F2C6304870016F5B6 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3A9FD58E2C6304870016F5B6 /* Assets.xcassets */; }; @@ -24,6 +27,9 @@ 103DFA8F2C660F0B00B7E00C /* PostManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostManager.swift; sourceTree = ""; }; 103DFA992C6AF3D900B7E00C /* JsonParser.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JsonParser.swift; sourceTree = ""; }; 103DFA9F2C6AF46000B7E00C /* en */ = {isa = PBXFileReference; lastKnownFileType = text.json; name = en; path = en.lproj/MockPost.json; sourceTree = ""; }; + 3A3AD4CA2C747CAA00F2EB2F /* TabBarIcon.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabBarIcon.swift; sourceTree = ""; }; + 3A3AD4CC2C747E7A00F2EB2F /* TabBarViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabBarViewModel.swift; sourceTree = ""; }; + 3A3AD4CE2C74870000F2EB2F /* TabBarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabBarView.swift; sourceTree = ""; }; 3A9FD5872C6304860016F5B6 /* CCB_USG_2024.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CCB_USG_2024.app; sourceTree = BUILT_PRODUCTS_DIR; }; 3A9FD58A2C6304860016F5B6 /* CCB_USG_2024App.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CCB_USG_2024App.swift; sourceTree = ""; }; 3A9FD58C2C6304860016F5B6 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; @@ -70,6 +76,9 @@ 103DFA8B2C660D7A00B7E00C /* Post.swift */, 103DFA9E2C6AF46000B7E00C /* MockPost.json */, 103DFA8F2C660F0B00B7E00C /* PostManager.swift */, + 3A3AD4CA2C747CAA00F2EB2F /* TabBarIcon.swift */, + 3A3AD4CC2C747E7A00F2EB2F /* TabBarViewModel.swift */, + 3A3AD4CE2C74870000F2EB2F /* TabBarView.swift */, ); path = CCB_USG_2024; sourceTree = ""; @@ -153,9 +162,12 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 3A3AD4CD2C747E7A00F2EB2F /* TabBarViewModel.swift in Sources */, + 3A3AD4CF2C74870000F2EB2F /* TabBarView.swift in Sources */, 3A9FD58D2C6304860016F5B6 /* ContentView.swift in Sources */, 103DFA872C633C9100B7E00C /* PostView.swift in Sources */, 103DFA9A2C6AF3D900B7E00C /* JsonParser.swift in Sources */, + 3A3AD4CB2C747CAA00F2EB2F /* TabBarIcon.swift in Sources */, 3A9FD58B2C6304860016F5B6 /* CCB_USG_2024App.swift in Sources */, 103DFA8C2C660D7A00B7E00C /* Post.swift in Sources */, 103DFA902C660F0B00B7E00C /* PostManager.swift in Sources */, diff --git a/CCB_USG_2024/Assets.xcassets/Symbols/Contents.json b/CCB_USG_2024/Assets.xcassets/Symbols/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/CCB_USG_2024/Assets.xcassets/Symbols/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/CCB_USG_2024/Assets.xcassets/Symbols/bell.imageset/Contents.json b/CCB_USG_2024/Assets.xcassets/Symbols/bell.imageset/Contents.json new file mode 100644 index 0000000..e7387d0 --- /dev/null +++ b/CCB_USG_2024/Assets.xcassets/Symbols/bell.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "bell.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/CCB_USG_2024/Assets.xcassets/Symbols/bell.imageset/bell.png b/CCB_USG_2024/Assets.xcassets/Symbols/bell.imageset/bell.png new file mode 100644 index 0000000000000000000000000000000000000000..3c3d07c82d41e9617373aa4731cce595396a00d2 GIT binary patch literal 574 zcmeAS@N?(olHy`uVBq!ia0vp^!ayv-!3HGrL)l7z6k~CayA#8@b22Z19GBDx&op0O z1}z|)gMqOEak- zAvkx6uZByY$nocfS2WU+A8Q*eRlBKSA|2g*Q$t%iQd`j1uvH9qf{u>dRlXO&+ zq($6LMrmrgiuK&z`T5-IS@+sMzWRP{=Kr7bKfk+EUcE8mM5vBf`UAdqiR`zW-W*hw z+Wc;U=OY1`LtzE&{;h26#~#XTyXs`ev+0m)MwqQh(wUvU*+=S3Cz~J8i8-jbCF`tt zk_1cTuRZG-Cr0td9QK-U{Ds7{2TZRH^;~)GAouHaYe=SWYt|=5iz1olv0oc@ynZFQ z`yH=yP7}+WTWt+{8vgNW?#|=SF5&jyc2Gb4>HHV#7uX(4<6m7aegBSx=#k~N$Flh+ z@7KKUt?6>_D3F)K|JwCulY4OIKHCJ(kB=s0nI0C{CAg{JP+d)ip^{v{bYX+1KP9g4 zr7JvNeOUXC;=%n4MfcQt=B6;`E#QA7I_bcEPF9cOGd0p(AMKj??|=028pT~N&NuK} z@&0bm|6z?%p-5K3)k`WSDRIB`3=?UY{Il_nnRHt!S8Ryn8m_iwgb&@x3?4-|Kvu6{1-oD!MU)5S5w zLh$XCjb6--0t^>y1y!{=mMV2^ZJpZMt6=7orETg_cgTF6Yl;p_ zhZ?R6c;4Kbvf->}XnAFP{A9k(%3Q)czn6W=xo9rgyua)JLB-?W()o|q7xr3jTYc{N z@rN04*Y6~?CI39P;Nd<;-`TUyRi^i|^Sw2<{hhSsgvjBit&{wMYEbWwFAW(_e0K+52N<_oVc))6Sn%`mJ}Iw>1=*cwG8HQ}(lc i-`VO{`CoiA?UuO7$I`^#?h_}00>;zT&t;ucLK6V!FPH)V literal 0 HcmV?d00001 diff --git a/CCB_USG_2024/Assets.xcassets/Symbols/ellipsis.imageset/Contents.json b/CCB_USG_2024/Assets.xcassets/Symbols/ellipsis.imageset/Contents.json new file mode 100644 index 0000000..f9145df --- /dev/null +++ b/CCB_USG_2024/Assets.xcassets/Symbols/ellipsis.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "ellipsis.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/CCB_USG_2024/Assets.xcassets/Symbols/ellipsis.imageset/ellipsis.png b/CCB_USG_2024/Assets.xcassets/Symbols/ellipsis.imageset/ellipsis.png new file mode 100644 index 0000000000000000000000000000000000000000..35e7b0f56573714d0dfe51cf1b112109533ddc2d GIT binary patch literal 292 zcmeAS@N?(olHy`uVBq!ia0vp^!a&Tz!3HFAnpxfhDaPU;cPEB*=VV?2IWDOYo@u_m z3|c@o2Loe!CIbsd2@p#GF#`kh0!9XAAk7F8TfhXD6<)v$XM=Pwd|EGU0;KvpT^vIs zB$NOA|G(denb}!QU_aZVlRZ5>_Zv(k7@k%%_QWWNF+5u7u(LgZQ-g7eKZ_A>Lj`ZZ zI|Jr`1Z{!)Esumuj&AiR%D(XA&V(m=%r~8U99W$^x+dIINK90*OfmD2h}4yyaGtqn zrn-PU<0D=No&F_~D$BW!%x?T4AYi@tWFgbhG{%pb3VIAD85yd!W(K%9{&WDj(9_k= JWt~$(69AsPO?dzS literal 0 HcmV?d00001 diff --git a/CCB_USG_2024/Assets.xcassets/Symbols/magnifyingglass.imageset/Contents.json b/CCB_USG_2024/Assets.xcassets/Symbols/magnifyingglass.imageset/Contents.json new file mode 100644 index 0000000..709a1cf --- /dev/null +++ b/CCB_USG_2024/Assets.xcassets/Symbols/magnifyingglass.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "magnifyingglass.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/CCB_USG_2024/Assets.xcassets/Symbols/magnifyingglass.imageset/magnifyingglass.png b/CCB_USG_2024/Assets.xcassets/Symbols/magnifyingglass.imageset/magnifyingglass.png new file mode 100644 index 0000000000000000000000000000000000000000..a2822cb3f2bd9ce08d15497b43070a1fc81e293f GIT binary patch literal 585 zcmeAS@N?(olHy`uVBq!ia0vp^!XV7S1|*9D%+3HQ#^NA%Cx&(BWL^R}E~ycoX}-P; zT0k}j17mw80}DtA5K93u0|WB{Mh0de%?J`(zyy~SUciiCgA^*{2P^|B+wAG$7-Au~ zbc(gUi=#xFY`I{eXG_Mmi5g)hkHQvQnjp~I)zx&!J|M&Ob$vEpU zDT_%dfobb~+s5NM8b=K^CpmdKI;Vst E0J>o0%K!iX literal 0 HcmV?d00001 diff --git a/CCB_USG_2024/CCB_USG_2024App.swift b/CCB_USG_2024/CCB_USG_2024App.swift index abf0f2b..abe3716 100644 --- a/CCB_USG_2024/CCB_USG_2024App.swift +++ b/CCB_USG_2024/CCB_USG_2024App.swift @@ -11,7 +11,7 @@ import SwiftUI struct CCB_USG_2024App: App { var body: some Scene { WindowGroup { - ContentView() + TabBarView() } } } diff --git a/CCB_USG_2024/TabBarIcon.swift b/CCB_USG_2024/TabBarIcon.swift new file mode 100644 index 0000000..2ca4c66 --- /dev/null +++ b/CCB_USG_2024/TabBarIcon.swift @@ -0,0 +1,16 @@ +// +// TabBarIcon.swift +// CCB_USG_2024 +// +// Created by jun on 8/20/24. +// + +import SwiftUI + +struct TabBarIcon: Identifiable { + var id = UUID() + let symbol: String + let text: String + var isclicked: Bool = false + let view: AnyView +} diff --git a/CCB_USG_2024/TabBarView.swift b/CCB_USG_2024/TabBarView.swift new file mode 100644 index 0000000..79557e4 --- /dev/null +++ b/CCB_USG_2024/TabBarView.swift @@ -0,0 +1,24 @@ +// +// TabBarView.swift +// CCB_USG_2024 +// +// Created by jun on 8/20/24. +// + +import SwiftUI + +struct TabBarView: View { + @State private var viewModel = TabBarViewModel() + + var body: some View { + TabView { + ForEach(viewModel.tabBarIcons) { tabBarIcon in + tabBarIcon.view + .tabItem { + Image(systemName: tabBarIcon.symbol) + Text(tabBarIcon.text) + } + } + } + } +} diff --git a/CCB_USG_2024/TabBarViewModel.swift b/CCB_USG_2024/TabBarViewModel.swift new file mode 100644 index 0000000..a167406 --- /dev/null +++ b/CCB_USG_2024/TabBarViewModel.swift @@ -0,0 +1,21 @@ +// +// TabBarViewModel.swift +// CCB_USG_2024 +// +// Created by jun on 8/20/24. +// + +import SwiftUI + +class TabBarViewModel: ObservableObject { + @Published var tabBarIcons: [TabBarIcon] + + init() { + tabBarIcons = [ + TabBarIcon(symbol: "magnifyingglass", text: "탐색", view: AnyView(PostView())), + TabBarIcon(symbol: "bookmark", text: "북마크", view: AnyView(Text("북마크"))), + TabBarIcon(symbol: "bell", text: "알림", view: AnyView(Text("알림"))), + TabBarIcon(symbol: "ellipsis", text: "더보기", view: AnyView(Text("더보기"))) + ] + } +}