[] 메인의 위/아래 바 구현

This commit is contained in:
Seonkyu_Kim 2025-02-04 18:03:47 +09:00
parent dfce91f13c
commit 1bb3558015
58 changed files with 618 additions and 65 deletions

13
.idea/.gitignore vendored Normal file
View File

@ -0,0 +1,13 @@
# Default ignored files
/shelf/
/workspace.xml
# Rider ignored files
/contentModel.xml
/projectSettingsUpdater.xml
/.idea.AcaMate_iOS.iml
/modules.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

8
.idea/indexLayout.xml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="UserContentModel">
<attachedFolders />
<explicitIncludes />
<explicitExcludes />
</component>
</project>

6
.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
uuid = "800DD51A-C089-4DC4-AE55-7F5ABD5C0AE7"
type = "1"
version = "2.0">
</Bucket>

View File

@ -1,57 +0,0 @@
//
// LoginView.swift
// AcaMate
//
// Created by Sean Kim on 12/1/24.
//
import SwiftUI
struct LoginView: View {
@EnvironmentObject var alertController: AlertController
@Binding var naviState : NaviState
var body: some View {
VStack(spacing: 0) {
Image("Team_Icon")
.resizable()
.frame(width: 200, height: 200)
.background(.white)
.border(.black)
.padding(.bottom, 84)
Button {
} label: {
HStack(spacing: 12) {
Image("Kakao_Icon")
.resizable()
.frame(width: 32, height: 32)
Text("카카오 계정으로 시작하기")
.font(.nps(font: .regular, size: 16))
.foregroundStyle(Color(.Text.black))
}
.padding(12)
.background {
RoundedRectangle(cornerRadius: 12)
.foregroundStyle(Color(.Other.yellow))
}
}
Button {
alertController.alertData = SetAlertData().setTest()
alertController.showAlert.toggle()
// naviState.set(act: .MOVE,path: .Intro)
} label: {
Text("111111111")
}
.padding()
}
.fullView(.Normal.normal)
}
}
//#Preview {
// LoginView()
//}

View File

@ -9,7 +9,7 @@ import SwiftUI
import Combine
///
struct NavigationView: View {
@State private var naviState : NaviState = .init(act: .NONE, path: .Intro)
@State private var history: [PathName] = [.Intro]
@ -25,7 +25,7 @@ struct NavigationView: View {
case .Login :
LoginView(naviState: $naviState)
case .Main:
EmptyView()
MainView(naviState: $naviState)
}
}
.onChange(of: naviState) { old, new in
@ -41,30 +41,33 @@ struct NavigationView: View {
case .MOVE:
moveHistory(path: new.path)
}
// LOG
printLog("\(old.path) => \(new.path)")
showHistory()
}
.fullView(.Normal.normal)
.fullDrawView(.Normal.normal)
.setAlert()
.setNetwork()
}
///
private func addHistory(path: PathName) {
history.append(path)
}
///
private func popHistory() {
history.removeLast()
naviState.set(act: .NONE, path: history.last ?? .NONE)
}
///
private func resetHistory(path: PathName) {
history.removeAll()
addHistory(path: path)
}
/// ,
private func moveHistory(path: PathName) {
if path == .NONE {
naviState.set(act: .RESET, path: history.first ?? .Main)

View File

@ -67,8 +67,6 @@ struct IntroView: View {
}
}
.store(in: &cancellables)
}
}
@ -78,7 +76,8 @@ struct IntroView: View {
.sink { action in
if action == "updateNow" {
exit(1)
//MARK: - TODO ( )
// MARK: TO-DO
// ( )
} else {
naviState.set(act: .RESET, path: .Login)
}

View File

@ -0,0 +1,93 @@
//
// LoginView.swift
// AcaMate
//
// Created by Sean Kim on 12/1/24.
//
import SwiftUI
struct LoginView: View {
@EnvironmentObject var alertController: AlertController
@Binding var naviState : NaviState
var body: some View {
VStack(spacing: 0) {
Image("Team_Icon")
.resizable()
.frame(maxWidth: 200, maxHeight: 200)
.frame(width: 200, height: 200)
.background(.white)
.border(.black)
.padding(.bottom, 84)
///
VStack(spacing: 16) {
Button {
// MARK: TO-DO
//
naviState.set(act: .MOVE, path: .Main)
} label: {
HStack(spacing: 24) {
Image("Kakao_Icon")
.resizable()
.frame(width: 32, height: 32)
Text("카카오 계정으로 시작하기")
.font(.nps(font: .regular, size: 16))
.foregroundStyle(Color(.Text.black))
}
.frame(maxWidth: .infinity)
.padding(12)
.background {
RoundedRectangle(cornerRadius: 12)
.foregroundStyle(Color(.Other.yellow))
}
}
.frame(maxWidth: .infinity)
/// KAKAO
Button {
// MARK: TO-DO
//
} label: {
HStack(spacing: 24) {
Image(systemName: "apple.logo")
.resizable()
.accentColor(Color(.Text.white))
.frame(width: 32, height: 32)
Text("애플 계정으로 시작하기")
.font(.nps(font: .regular, size: 16))
.foregroundStyle(Color(.Text.white))
}
.frame(maxWidth: .infinity)
.padding(12)
.background {
RoundedRectangle(cornerRadius: 12)
.foregroundStyle(Color(.Text.black))
}
}
.frame(maxWidth: .infinity)
/// APPLE
}
.padding([.leading,.trailing], 28)
///
//
// Button {
// alertController.alertData = SetAlertData().setTest()
// alertController.showAlert.toggle()
// // naviState.set(act: .MOVE,path: .Intro)
//
// } label: {
// Text("111111111")
// }
}
.fullDrawView(.Normal.normal)
}
}
//#Preview {
// LoginView()
//}

View File

@ -0,0 +1,39 @@
//
// BoxBtnView.swift
// AcaMate
//
// Created by TAnine on 2/4/25.
//
import SwiftUI
struct BoxBtnView<Content: View>: View {
let width: CGFloat
let height: CGFloat
let action: VOID_TO_VOID?
@ViewBuilder let content: Content
var body: some View {
Button{
guard let action = action else { return }
action()
} label: {
content
// if let image = image {
// image
// .resizable()
// .frame(width: width, height: height)
// }
}
}
}
#Preview {
BoxBtnView(width: 40, height: 40, action: nil){
VStack {
Text("Test1")
Text("Test2")
}
}
}

View File

@ -0,0 +1,56 @@
//
// ButtonView.swift
// AcaMate
//
// Created by TAnine on 2/4/25.
//
import SwiftUI
struct CircleBtnView: View {
let title: String?
let image: Image
@Binding var isSelected: Bool
let isReverse: Bool
let action: VOID_TO_VOID?
var backColor: Color {isReverse ? Color(.Second.light) : Color(.Normal.normal)}
var tintColor: Color {isSelected ? Color(.Second.normal) : Color(.Disable.normal)}
var body: some View {
Button{
guard let action = action else {return}
action()
} label: {
VStack(alignment: .center, spacing: 0) {
self.image
.resizable()
.renderingMode(.template)
.foregroundStyle(self.tintColor)
.frame(width: 24, height: 24)
if let title = self.title {
Text("\(title)")
.font(.nps(font: .bold, size: 6))
.tint(self.tintColor)
}
}
.padding()
.background {
if isReverse {
Circle()
.accentColor(self.backColor)
.frame(width: 48, height: 48)
.innerShadow(shape: Circle(), color: Color(.Text.black).opacity(0.75), blur: 8, x: 0, y: 4)
} else {
Circle()
.accentColor(self.backColor)
.frame(width: 48, height: 48)
.shadow(color: Color(.Text.black).opacity(0.75), radius: 8, x: 4, y: 8)
}
}
}
}
}

View File

@ -0,0 +1,45 @@
//
// SimpleBtnView.swift
// AcaMate
//
// Created by TAnine on 2/4/25.
//
import SwiftUI
struct SimpleBtnView: View {
let title: String?
let image: Image?
let font: Font?
let width: CGFloat
let height: CGFloat
let action: VOID_TO_VOID?
var body: some View {
Button{
guard let action = action else { return }
action()
} label: {
if let title = title, let font = font {
Text("\(title)")
.font(font)
.tint(Color(.Second.dark))
.frame(width: width, height: height)
}
else if let image = image {
image
.resizable()
.frame(width: width, height: height)
}
}
}
}
#Preview {
SimpleBtnView(title: "체크 합니다", image: Image(.BottomBar.home),
font: .nps(font: .bold, size: 12),
width: 40, height: 40,
action: nil)
}

View File

@ -0,0 +1,79 @@
//
// BottomView.swift
// AcaMate
//
// Created by TAnine on 2/4/25.
//
import SwiftUI
struct BottomView: View {
@State private var isHomeSelected: Bool = true
@State private var isManagementSelected: Bool = false
@State private var isChattingSelected: Bool = false
@State private var isCalendarSelected: Bool = false
@State private var isEtcSelected: Bool = false
var body: some View {
HStack(spacing: 0){
Spacer(minLength: 1)
CircleBtnView(title: "", image: Image(.BottomBar.home),
isSelected: $isHomeSelected, isReverse: false,
action: {
btnAllFalse()
isHomeSelected.toggle()
})
Spacer(minLength: 1)
CircleBtnView(title: "학습 관리", image: Image(.BottomBar.management),
isSelected: $isManagementSelected, isReverse: false,
action: {
btnAllFalse()
isManagementSelected.toggle()
})
Spacer(minLength: 1)
CircleBtnView(title: "채팅", image: Image(.BottomBar.chatting),
isSelected: $isChattingSelected, isReverse: false,
action: {
btnAllFalse()
isChattingSelected.toggle()
})
Spacer(minLength: 1)
CircleBtnView(title: "일정", image: Image(.BottomBar.calendar),
isSelected: $isCalendarSelected, isReverse: false,
action: {
btnAllFalse()
isCalendarSelected.toggle()
})
Spacer(minLength: 1)
CircleBtnView(title: "더보기", image: Image(.BottomBar.etc),
isSelected: $isEtcSelected, isReverse: false,
action: {
btnAllFalse()
isEtcSelected.toggle()
})
Spacer(minLength: 1)
}
.padding([.top],12)
.background {
Rectangle()
.foregroundStyle(Color(.Normal.dark))
.ignoresSafeArea(edges: .bottom)
}
.frame(maxWidth: .infinity)
}
private func btnAllFalse() {
isHomeSelected = false
isManagementSelected = false
isChattingSelected = false
isCalendarSelected = false
isEtcSelected = false
}
}
#Preview {
BottomView()
}

View File

@ -0,0 +1,34 @@
//
// MainView.swift
// AcaMate
//
// Created by TAnine on 2/4/25.
//
import SwiftUI
import Combine
struct MainView: View {
@EnvironmentObject var alertController: AlertController
@State var cancellables: Set<AnyCancellable> = []
@Binding var naviState : NaviState
var body: some View {
VStack(spacing: 0) {
TopView(titleName: "Name")
Spacer()
BottomView()
.frame(maxWidth: .infinity)
// .backgroundStyle(Color(.Normal.dark))
// .safeAreaInset(edge: .bottom, spacing: 0) {
// Color(.Normal.dark)
//// .frame(height: 0)
// }
}
// .fullDrawView(Color(.Normal.dark))
}
}

View File

@ -0,0 +1,43 @@
//
// TopView.swift
// AcaMate
//
// Created by TAnine on 2/4/25.
//
import SwiftUI
struct TopView: View {
@State var titleName: String = ""
var body: some View {
HStack(alignment: .center, spacing: 0) {
SimpleBtnView(title: nil, image: Image(.TopBar.face), font: nil, width: 40, height: 40, action: {
})
.padding(EdgeInsets(top: 12, leading: 24, bottom: 12, trailing: 12))
Text("\(titleName)")
.tint(Color(.Text.disabled))
.font(.nps(font: .bold, size: 20))
Spacer()
SimpleBtnView(title: nil, image: Image(.TopBar.face), font: nil, width: 40, height: 40, action: {
})
.hidden()
}
.background {
Rectangle()
.foregroundStyle(Color(.Other.cell))
.ignoresSafeArea(edges: .top)
}
.frame(maxWidth: .infinity)
}
}
#Preview {
TopView(titleName: "Name")
}

View File

@ -16,6 +16,7 @@ public let API_URL: String = "https://acamate.ipstein.myds.me"
// MARK: - TYPEALIAS
typealias VOID_TO_VOID = () -> ()
// MARK: - VARIABLE
public var APPSTORE_URL = "https://itunes.apple.com/app/"
public var KEYBOARD_UP_HEIGHT: CGFloat = 46.0

View File

@ -46,7 +46,8 @@ struct AlertModifier: ViewModifier {
}
extension View {
func fullView(_ backColor: Color) -> some View {
/// View
func fullDrawView(_ backColor: Color) -> some View {
return self
.frame(maxWidth: .infinity, maxHeight: .infinity)
.background(backColor)
@ -68,4 +69,14 @@ extension View {
.navigationBarBackButtonHidden(true)
.toolbar(.hidden, for: .navigationBar)
}
func innerShadow<S: Shape> (shape: S, color: Color, lineWidth: CGFloat = 6, blur: CGFloat, x: CGFloat, y: CGFloat) -> some View {
return self.overlay {
shape
.stroke(color, lineWidth: lineWidth)
.offset(x: x, y: y)
.blur(radius: blur)
.mask(shape.fill(LinearGradient(gradient: Gradient(colors: [.black, .clear]), startPoint: .topLeading, endPoint: .bottomTrailing)))
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 636 B

View File

@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "Calendar.png",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 543 B

View File

@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "Chatting.png",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,9 @@
{
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"provides-namespace" : true
}
}

View File

@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "Etc.png",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 635 B

View File

@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "Home.png",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 604 B

View File

@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "Management.png",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 577 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 587 B

View File

@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "Back.png",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,9 @@
{
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"provides-namespace" : true
}
}

View File

@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "Edit.png",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 684 B

View File

@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "Face.png",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "Market.png",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 535 B

View File

@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "Person.png",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "Plus.png",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 261 B

View File

@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "Save.png",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 844 B

View File

@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "Setting.png",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 636 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 543 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 635 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 604 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 577 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 587 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 684 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 535 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 261 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 844 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB