Skip to content
8 changes: 6 additions & 2 deletions MarketApp/MarketApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
EC892ABB290820B800D02F99 /* FavoriteView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC892ABA290820B800D02F99 /* FavoriteView.swift */; };
EC892ABD290820C600D02F99 /* ProfileView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC892ABC290820C600D02F99 /* ProfileView.swift */; };
EC892ABF2908214900D02F99 /* ProductView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC892ABE2908214900D02F99 /* ProductView.swift */; };
EC92575C29B03D0700F13132 /* CommunityView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC92575B29B03D0700F13132 /* CommunityView.swift */; };
ECB2F1362909258B00E9F7D3 /* PopView.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECB2F1352909258B00E9F7D3 /* PopView.swift */; };
ECF5BE462914D01E0052655B /* ReviewView.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECF5BE452914D01E0052655B /* ReviewView.swift */; };
/* End PBXBuildFile section */
Expand Down Expand Up @@ -199,6 +200,7 @@
EC892ABA290820B800D02F99 /* FavoriteView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FavoriteView.swift; sourceTree = "<group>"; };
EC892ABC290820C600D02F99 /* ProfileView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileView.swift; sourceTree = "<group>"; };
EC892ABE2908214900D02F99 /* ProductView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductView.swift; sourceTree = "<group>"; };
EC92575B29B03D0700F13132 /* CommunityView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommunityView.swift; sourceTree = "<group>"; };
ECB2F1352909258B00E9F7D3 /* PopView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PopView.swift; sourceTree = "<group>"; };
ECF5BE452914D01E0052655B /* ReviewView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReviewView.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
Expand Down Expand Up @@ -663,6 +665,7 @@
EC892ABE2908214900D02F99 /* ProductView.swift */,
ECB2F1352909258B00E9F7D3 /* PopView.swift */,
EC451F6D290BBCD7008C88A7 /* InfoView.swift */,
EC92575B29B03D0700F13132 /* CommunityView.swift */,
ECF5BE452914D01E0052655B /* ReviewView.swift */,
);
path = ProductDetail;
Expand Down Expand Up @@ -945,6 +948,7 @@
7F0F165B296C4CBF00FB4C30 /* SignUPView.swift in Sources */,
7F4B9629298D17C3006AAF48 /* View+ReceiveTimer.swift in Sources */,
EC892ABB290820B800D02F99 /* FavoriteView.swift in Sources */,
EC92575C29B03D0700F13132 /* CommunityView.swift in Sources */,
7F0F1655296C456E00FB4C30 /* LoginItem.swift in Sources */,
7F4B9623298D16E9006AAF48 /* ACarouselAutoScroll.swift in Sources */,
7F0F1653296C3AFD00FB4C30 /* SignUPViewModel.swift in Sources */,
Expand Down Expand Up @@ -1141,7 +1145,7 @@
CURRENT_PROJECT_VERSION = 3;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_ASSET_PATHS = "\"MarketApp/Preview Content\"";
DEVELOPMENT_TEAM = N94CS4N6VR;
DEVELOPMENT_TEAM = "";
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = MarketApp/Info.plist;
Expand Down Expand Up @@ -1183,7 +1187,7 @@
CURRENT_PROJECT_VERSION = 3;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_ASSET_PATHS = "\"MarketApp/Preview Content\"";
DEVELOPMENT_TEAM = N94CS4N6VR;
DEVELOPMENT_TEAM = "";
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = MarketApp/Info.plist;
Expand Down
76 changes: 76 additions & 0 deletions MarketApp/MarketApp/View/ProductDetail/CommunityView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
//
// CommunityView.swift
// MarketApp
//
// Created by 홍태희 on 2023/03/02.
//

import SwiftUI
import ExytePopupView

//MARK : 커뮤니티
let dateformat: DateFormatter = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

@Dtzer0 여기는 공용 파일을 만들어서 분해 하는거 어떨까요 ??

let formatter = DateFormatter()
formatter.dateFormat = "YYYY.MM.dd HH:MM:SS"
return formatter
}()

struct CommunityBlock : View {
var nickName : String
var time = Date()
var comment : String

var body: some View {
ZStack {
Rectangle()
.fill(.white)
.frame(maxWidth: 360, minHeight: 70)
.overlay {
RoundedRectangle(cornerRadius: 20)
.stroke(Color.black, lineWidth: 1)
}

VStack(alignment: .leading) {
HStack {
Text("\(nickName)")
.nanumSquareNeo(family: .cBd, size: 18, color: .black)
Text("\(time, formatter: dateformat)")
.nanumSquareNeo(family: .cBd, size: 15, color: .gray)
}
Text("\(comment)")
.nanumSquareNeo(family: .cBd, size: 15, color: .black)
}
}.padding(.top, 10)
}
}

struct WriteComments : View {
Copy link
Collaborator

Choose a reason for hiding this comment

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

@Dtzer0 한파일에 뷰가 두개가 있네요 파일 을 분해해서 각각 사용 하는 거 어떨까요 ??
왜 저헐게 한파일레 두개의 뷰를 만들었나용 ??

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

둘 다 커뮤니티 뷰에 속하는 뷰라서 하나에 다 넣은거에요! 하나는 댓글목록UI고 하나는 댓글textfield에요.

@State private var comments = ""
@State var backPop = false

var body: some View {
ZStack {
HStack {
TextField("댓글을 입력해주세요.", text: $comments)
.padding()
.background(Color(uiColor: .secondarySystemBackground))
.cornerRadius(20)

Button(action: {
//TODO : 문장 입력 후 완료 버튼을 누르면 CommunityBlock 뷰에 해당 문장이 올라가게끔 설계
}, label: {
Text("올리기")
.frame(width: 50)
.nanumSquareNeo(family: .cBd, size: 15, color: .black)
})
}
}//동작안함. ( bp해두고 돌려봤을때는 잘찍힘 )
Copy link
Collaborator

Choose a reason for hiding this comment

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

@Dtzer0 button에서 액션을 해줘야 팝업이 나올거 같아요!

.popup(isPresented: $backPop, type: .default, position: .top, animation: .spring(), dragToDismiss: true, closeOnTap: false, closeOnTapOutside: true) {
Text("서비스 준비중이에요!")
.frame(width: 300, height: 50)
.backgroundStyle(.black)
.cornerRadius(20)
.nanumSquareNeo(family: .cBd, size: 20, color: .white)
}
}
}
49 changes: 10 additions & 39 deletions MarketApp/MarketApp/View/ProductDetail/InfoView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,56 +58,27 @@ struct testView : View {
var tests : tapInfo

var body: some View {
ScrollView(.vertical, showsIndicators: false) {
switch tests {
case .info:
switch tests {
case .info:
ScrollView(showsIndicators: false) {
ForEach(0..<5) { _ in
Text("블랙컬러")
.padding()
Image("shoes")
.resizable()
.frame(maxWidth: 350, minHeight: 500)
}
case .community:

}
case .community:
VStack {
ScrollView(showsIndicators: false) {
ForEach(0..<7) { _ in
ForEach(0..<10) { _ in
CommunityBlock(nickName: "Zero",
comment: "요즘 매종 키츠네 신발 유행인가요? 알려주세요 :)")
comment: "요즘 매종 키츠네 신발이 유행인가요? 알려주세요 :)")
}
}
}
}
}
}

//MARK : 커뮤니티
let dateformat: DateFormatter = {
let formatter = DateFormatter()
formatter.dateFormat = "YYYY년 M월 d일"
return formatter
}()

struct CommunityBlock : View {
var nickName : String
var time = Date()
var comment : String

var body: some View {
ZStack {
Rectangle()
.fill(.black)
.frame(maxWidth: 360, minHeight: 60)
.cornerRadius(20)

VStack(alignment: .leading) {
HStack {
Text("\(nickName)님")
.foregroundColor(.white) //커스텀컴포넌트로 변경예정
Text("\(time, formatter: dateformat)")
.foregroundColor(.gray)
}
Text("\(comment)")
.foregroundColor(.white) //커스텀컴포넌트로 변경예정
WriteComments()
}
}
}
Expand Down
110 changes: 38 additions & 72 deletions MarketApp/MarketApp/View/ProductDetail/ProductView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,84 +13,50 @@ struct ProductView: View {
@State private var buyThis = false

var body: some View {
VStack {
ScrollView(.vertical, showsIndicators: true) {
Image("shoes")
.resizable()
.frame(height: 350)

HStack {
VStack {
Text("Maison Kitsune")
.font(.system(size: 15, weight: .bold, design: .monospaced))
.frame(width: 250, height: 20, alignment: .leading)
Text("더블 폭스 패치 스니커즈")
.font(.system(size: 18, weight: .medium, design: .default))
.frame(width: 250, height: 20, alignment: .leading)
Text("281,000원")
.font(.system(size: 15, weight: .bold, design: .monospaced))
.frame(width: 250, height: 20, alignment: .leading)
}

VStack {
Image(systemName: "star.fill").resizable()
.frame(width: 30, height: 30, alignment: .center)
.foregroundColor(.yellow)
Text("4.5")
.font(.system(size: 18, weight: .medium, design: .default))
}.frame(width: 50)

VStack(alignment: .center) {
Button(action: {
//좋아요 액션 ( 클릭시 heart.fill )
}) {
Image(systemName: "heart")
.resizable()
.renderingMode(.original)
.frame(width: 30, height: 30)
}

Text("LIKE")
.font(.system(size: 18, weight: .medium, design: .default))
}.frame(width: 50)
}
.padding(.top, 10)
.padding(.bottom, 10)

ScrollView {
VStack {
DetailInfo()
Copy link
Collaborator

Choose a reason for hiding this comment

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

@Dtzer0 코드가 짧아졌네용 ㅎㅎ 역시 점점 느시는 군요

InfoView()
}
.bounce(false)
}
}

@ViewBuilder
private func DetailInfo() -> some View {
VStack {
Image("shoes")
.resizable()
.frame(height: 350)

HStack {
Button(action: {
//좋아요 액션 ( 클릭시 heart.fill )
}) {
Image(systemName: "heart")
.resizable()
.renderingMode(.original)
.frame(width: 30, height: 30)
.padding(.trailing, 10)
VStack {
Text("Maison Kitsune")
.font(.system(size: 15, weight: .bold, design: .monospaced))
.frame(width: 280, height: 20, alignment: .leading)
Text("더블 폭스 패치 스니커즈")
.font(.system(size: 18, weight: .medium, design: .default))
.frame(width: 280, height: 20, alignment: .leading)
Text("281,000원")
.font(.system(size: 15, weight: .bold, design: .monospaced))
.frame(width: 280, height: 20, alignment: .leading)
}

Button(action: {
buyThis.toggle()
}) {
Text("구매")
.font(.system(size: 22, weight: .medium, design: .default))
.frame(width: 280, height: 50)
.padding(.leading, 10)
.background(.black)
.foregroundColor(.white)
.sheet(isPresented: self.$buyThis) {
if #available(iOS 16.0, *) {
PopView()
.presentationDetents([.height(300)])
} else {
PopView()
}
}
}
}.padding(.bottom, 20)
VStack(alignment: .center) {
Button(action: {
//좋아요 액션 ( 클릭시 heart.fill )
}) {
Image(systemName: "heart")
.resizable()
.renderingMode(.original)
.frame(width: 30, height: 30)
}

Text("LIKE")
.font(.system(size: 18, weight: .medium, design: .default))
}.frame(width: 50)
}
.padding(.top, 10)
Copy link
Collaborator

Choose a reason for hiding this comment

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

@Dtzer0 이런 경우는 padding을 vertical을 주는거 어떨까요 ??

.padding(.bottom, 10)
}
}
}
Expand Down