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

[정주] Pillyze - 내건강 화면 구현 (내부 콘텐츠 제외) #3

Merged
merged 8 commits into from
Jul 14, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@
9B0470082C41735D00ADAFF3 /* BoostPillyzeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B0470072C41735D00ADAFF3 /* BoostPillyzeTests.swift */; };
9B0470252C427F6C00ADAFF3 /* MainTabBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B0470242C427F6C00ADAFF3 /* MainTabBar.swift */; };
9B04702B2C4288DB00ADAFF3 /* View+cornerRadius.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B04702A2C4288DB00ADAFF3 /* View+cornerRadius.swift */; };
9B5AE8262C42AAD200BC1ED7 /* MyHealthViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B5AE8252C42AAD200BC1ED7 /* MyHealthViewController.swift */; };
9B5AE82C2C42B26E00BC1ED7 /* BaseViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B5AE82B2C42B26E00BC1ED7 /* BaseViewController.swift */; };
9B5AE82F2C42B29A00BC1ED7 /* BaseView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B5AE82E2C42B29A00BC1ED7 /* BaseView.swift */; };
9B5AE8312C42B2E500BC1ED7 /* ViewModelable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B5AE8302C42B2E500BC1ED7 /* ViewModelable.swift */; };
9B5AE8332C42B49E00BC1ED7 /* MyHealthView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B5AE8322C42B49E00BC1ED7 /* MyHealthView.swift */; };
9B5AE8352C42B54200BC1ED7 /* LayoutViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B5AE8342C42B54200BC1ED7 /* LayoutViewController.swift */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand All @@ -36,6 +42,12 @@
9B0470072C41735D00ADAFF3 /* BoostPillyzeTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BoostPillyzeTests.swift; sourceTree = "<group>"; };
9B0470242C427F6C00ADAFF3 /* MainTabBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainTabBar.swift; sourceTree = "<group>"; };
9B04702A2C4288DB00ADAFF3 /* View+cornerRadius.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "View+cornerRadius.swift"; sourceTree = "<group>"; };
9B5AE8252C42AAD200BC1ED7 /* MyHealthViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyHealthViewController.swift; sourceTree = "<group>"; };
9B5AE82B2C42B26E00BC1ED7 /* BaseViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseViewController.swift; sourceTree = "<group>"; };
9B5AE82E2C42B29A00BC1ED7 /* BaseView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseView.swift; sourceTree = "<group>"; };
9B5AE8302C42B2E500BC1ED7 /* ViewModelable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewModelable.swift; sourceTree = "<group>"; };
9B5AE8322C42B49E00BC1ED7 /* MyHealthView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyHealthView.swift; sourceTree = "<group>"; };
9B5AE8342C42B54200BC1ED7 /* LayoutViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LayoutViewController.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -77,10 +89,11 @@
9B046FF52C41735B00ADAFF3 /* BoostPillyze */ = {
isa = PBXGroup;
children = (
9B5AE8292C42B23600BC1ED7 /* UIkit */,
9B046FF62C41735B00ADAFF3 /* BoostPillyzeApp.swift */,
9B046FF82C41735B00ADAFF3 /* ContentView.swift */,
9B0470232C427F5B00ADAFF3 /* TabBar */,
9B0470202C41752100ADAFF3 /* Home */,
9B0470202C41752100ADAFF3 /* MyHealth */,
9B0470282C4288C300ADAFF3 /* Extensions */,
9B0470212C41752800ADAFF3 /* Resource */,
9B046FFC2C41735C00ADAFF3 /* Preview Content */,
Expand All @@ -104,11 +117,13 @@
path = BoostPillyzeTests;
sourceTree = "<group>";
};
9B0470202C41752100ADAFF3 /* Home */ = {
9B0470202C41752100ADAFF3 /* MyHealth */ = {
isa = PBXGroup;
children = (
9B5AE8252C42AAD200BC1ED7 /* MyHealthViewController.swift */,
9B5AE8322C42B49E00BC1ED7 /* MyHealthView.swift */,
);
path = Home;
path = MyHealth;
sourceTree = "<group>";
};
9B0470212C41752800ADAFF3 /* Resource */ = {
Expand Down Expand Up @@ -143,6 +158,25 @@
path = View;
sourceTree = "<group>";
};
9B5AE8292C42B23600BC1ED7 /* UIkit */ = {
isa = PBXGroup;
children = (
9B5AE82D2C42B28D00BC1ED7 /* Base */,
);
path = UIkit;
sourceTree = "<group>";
};
9B5AE82D2C42B28D00BC1ED7 /* Base */ = {
isa = PBXGroup;
children = (
9B5AE8342C42B54200BC1ED7 /* LayoutViewController.swift */,
9B5AE82B2C42B26E00BC1ED7 /* BaseViewController.swift */,
9B5AE82E2C42B29A00BC1ED7 /* BaseView.swift */,
9B5AE8302C42B2E500BC1ED7 /* ViewModelable.swift */,
);
path = Base;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand Down Expand Up @@ -243,10 +277,16 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
9B5AE8352C42B54200BC1ED7 /* LayoutViewController.swift in Sources */,
9B0470252C427F6C00ADAFF3 /* MainTabBar.swift in Sources */,
9B5AE8332C42B49E00BC1ED7 /* MyHealthView.swift in Sources */,
9B5AE8262C42AAD200BC1ED7 /* MyHealthViewController.swift in Sources */,
9B04702B2C4288DB00ADAFF3 /* View+cornerRadius.swift in Sources */,
9B046FF92C41735B00ADAFF3 /* ContentView.swift in Sources */,
9B5AE82F2C42B29A00BC1ED7 /* BaseView.swift in Sources */,
9B046FF72C41735B00ADAFF3 /* BoostPillyzeApp.swift in Sources */,
9B5AE8312C42B2E500BC1ED7 /* ViewModelable.swift in Sources */,
9B5AE82C2C42B26E00BC1ED7 /* BaseViewController.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,21 @@ struct ContentView: View {
@State private var selectedTab = Tab.myHealth

var body: some View {
VStack {
Spacer()
Text("Selected Tab: \(selectedTab)")
Spacer()
ZStack {
switch selectedTab {
case .myHealth:
MyHealthRepresentView()
.ignoresSafeArea()
case .nutrients:
Text("Selected Tab: \(selectedTab)")
}

MainTabBar(selectedTab: $selectedTab)
VStack {
Spacer()
MainTabBar(selectedTab: $selectedTab)
}
}
.background(Color.white)
.background(Color.background)
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
//
// MyHealthView.swift
// BoostPillyze
//
// Created by 유정주 on 7/13/24.
//

import SwiftUI

struct MyHealthView: View {

// MARK: - Body

var body: some View {
VStack(spacing: 0) {
HStack {
Image(.logo)
Spacer()
HStack {
Button(
action: {},
label: { Image(.headerCalendar) }
)
Button(
action: {},
label: { Image(.headerNotification) }
)
Button(
action: {},
label: { Image(.headerProfile) }
)
}
}
.padding(.horizontal)
.background(Color.primaryNormal)

ScrollView {
VStack(spacing: 0) {
CalendarList()
.frame(height: 80, alignment: .top)
.background(Color.primaryNormal)

ZStack {
Rectangle()
.frame(height: 50)
.foregroundStyle(Color.primaryNormal)
Rectangle()
.foregroundStyle(Color.primaryPlaceholder)
.cornerRadius(24, corners: [.topLeft, .topRight])
}
}
}
}
.background(Color.primaryPlaceholder)
}
}

// MARK: - Calendar

private struct CalendarList: View {

// MARK: - Body

var body: some View {
ScrollView(.horizontal, showsIndicators: false) {
HStack {
ForEach(0..<31) { index in
CalendarListItem(
isToday: index == 0,
week: dates[index % 7],
day: days[index]
)
}
}
.padding(.horizontal)
}
}

// MARK: - Attribute

private let dates = ["월", "화", "수", "목", "금", "토", "일"]
private let days = Array(1...31)
}

private struct CalendarListItem: View {

// MARK: - Body

var body: some View {
VStack(spacing: 0) {
if isToday {
Text(week)
.font(.system(size: 12))
.padding()
.foregroundStyle(Color.primaryNormal)
.background(
Circle()
.fill(Color.white)
.frame(width: 24, height: 24)
)
} else {
Text(week)
.font(.system(size: 12))
.padding()
.foregroundStyle(Color.primaryDisabled)
}

Text("\(day)")
.foregroundStyle(.white)
.font(.system(size: 14, weight: .bold))
}
}

// MARK: - Attribute

private let isToday: Bool
private let week: String
private let day: Int

// MARK: - Initializer

init(isToday: Bool, week: String, day: Int) {
self.isToday = isToday
self.week = week
self.day = day
}
}


// MARK: - Preview

#Preview {
MyHealthView()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// MyHealthViewController.swift
// BoostPillyze
//
// Created by 유정주 on 7/13/24.
//

import UIKit
import SwiftUI

// MARK: - MyHealthRepresentView

struct MyHealthRepresentView: UIViewControllerRepresentable {

func makeUIViewController(context: Context) -> some UIViewController {
MyHealthViewController(rootView: MyHealthView())
}

func updateUIViewController(_ uiViewController: UIViewControllerType, context: Context) {}
}

// MARK: - MyHealthViewController

final class MyHealthViewController: LayoutViewController<MyHealthView> {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "Logo.svg",
"idiom" : "universal"
}
],
"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
Expand Up @@ -53,7 +53,6 @@ struct MainTabBar: View {
}

Button {
print("추가")
} label: {
Image(.buttonTabbarAdd)
.offset(y: -12)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
//
// BaseView.swift
// BoostPillyze
//
// Created by 유정주 on 7/13/24.
//

import UIKit

class BaseView: UIView {

// MARK: - Initializer

override init(frame: CGRect = .zero) {
super.init(frame: frame)
setUpAttribute()
setUpSubview()
setUpConstraint()
setUpBinding()
}

required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

// MARK: - Setup

/// View의 Attribute 속성을 설정
func setUpAttribute() { }

/// View의 Subview를 설정
func setUpSubview() { }

/// View의 Subview Constraints를 설정
func setUpConstraint() { }

/// View의 Binding을 설정
func setUpBinding() { }
}
Loading