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

[FEAT] #2 메인 UI 구성 #30

Merged
merged 1 commit into from
Jul 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 16 additions & 0 deletions NeflixCloneCoding/NeflixCloneCoding.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
78AF38AA287A9BA700BA81D4 /* MainPoster.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78AF38A9287A9BA600BA81D4 /* MainPoster.swift */; };
78AF38B2287A9FBC00BA81D4 /* BebasNeue.otf in Resources */ = {isa = PBXBuildFile; fileRef = 78AF38B1287A9FBC00BA81D4 /* BebasNeue.otf */; };
78AF38B5287AB2D600BA81D4 /* RowMovieList.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78AF38B4287AB2D600BA81D4 /* RowMovieList.swift */; };
B919C987287DF5AA00EB9D42 /* ContentDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B919C986287DF5AA00EB9D42 /* ContentDetailView.swift */; };
B919C989287DF62F00EB9D42 /* Storage.swift in Sources */ = {isa = PBXBuildFile; fileRef = B919C988287DF62F00EB9D42 /* Storage.swift */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand All @@ -32,6 +34,8 @@
78AF38AD287A9EA600BA81D4 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
78AF38B1287A9FBC00BA81D4 /* BebasNeue.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = BebasNeue.otf; sourceTree = "<group>"; };
78AF38B4287AB2D600BA81D4 /* RowMovieList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RowMovieList.swift; sourceTree = "<group>"; };
B919C986287DF5AA00EB9D42 /* ContentDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentDetailView.swift; sourceTree = "<group>"; };
B919C988287DF62F00EB9D42 /* Storage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Storage.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -67,10 +71,12 @@
78AF38AD287A9EA600BA81D4 /* Info.plist */,
78AF38AB287A9E7400BA81D4 /* fonts */,
7862CCDB2875B0DA00FE3545 /* Main */,
B919C985287DF58500EB9D42 /* Detail */,
78268A99287016BB0099F75C /* NeflixCloneCodingApp.swift */,
78268A9B287016BB0099F75C /* ContentView.swift */,
78268A9D287016BC0099F75C /* Assets.xcassets */,
78268A9F287016BC0099F75C /* Preview Content */,
B919C988287DF62F00EB9D42 /* Storage.swift */,
);
path = NeflixCloneCoding;
sourceTree = "<group>";
Expand Down Expand Up @@ -103,6 +109,14 @@
path = fonts;
sourceTree = "<group>";
};
B919C985287DF58500EB9D42 /* Detail */ = {
isa = PBXGroup;
children = (
B919C986287DF5AA00EB9D42 /* ContentDetailView.swift */,
);
path = Detail;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand Down Expand Up @@ -177,7 +191,9 @@
78268A9C287016BB0099F75C /* ContentView.swift in Sources */,
78AF38B5287AB2D600BA81D4 /* RowMovieList.swift in Sources */,
78AF38AA287A9BA700BA81D4 /* MainPoster.swift in Sources */,
B919C987287DF5AA00EB9D42 /* ContentDetailView.swift in Sources */,
78268A9A287016BB0099F75C /* NeflixCloneCodingApp.swift in Sources */,
B919C989287DF62F00EB9D42 /* Storage.swift in Sources */,
78AF38A328770BE700BA81D4 /* TopContent.swift in Sources */,
78AF38A72878798600BA81D4 /* CategoryselectionView.swift in Sources */,
78AF389F2877033E00BA81D4 /* NetflixMain.swift in Sources */,
Expand Down
110 changes: 110 additions & 0 deletions NeflixCloneCoding/NeflixCloneCoding/Detail/ContentDetailView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
//
// ContentDetailView.swift
// NeflixCloneCoding
//
// Created by 정지혁 on 2022/07/13.
//

import SwiftUI

struct ContentDetailView: View {
var columns: [GridItem] = Array(repeating: .init(.flexible(), spacing: 7), count: 3)

var body: some View {
ZStack {
Color.black
.ignoresSafeArea()

ScrollView {
VStack(alignment: .leading, spacing: 0) {
TopRoundedRectangleImage(radius: 13, height: 220, imageName: "MainTitle")

Text("이상한 나라의 수학자")
.font(.system(size: 16))
.padding(.horizontal, 8)
.padding(.vertical, 10)

Text("학업과 재정 측면에서 어려움을 겪고 있는 학생. 학교 경비원에게 수학을 가르쳐 달라고 요청한다. 그리고 성적보다 훨씬 더 많은 것을 얻게 되는데.")
.font(.system(size: 12))
.padding(.horizontal, 8)

HStack(spacing: 0) {
Text("출연: ")
.font(.system(size: 10))

Text("최민식, 김동회, 박병은 ...")
.font(.system(size: 10))

Button(action: {}, label: {
Text("더보기")
.font(.system(size: 10))
.fontWeight(.semibold)
.foregroundColor(.secondary)
})
}
.padding(.horizontal, 8)
.padding(.top, 10)

HStack(spacing: 0) {
Text("감독: ")
.font(.system(size: 10))

Text("박동훈")
.font(.system(size: 10))
}
.padding(.horizontal, 8)
.padding(.top, 4)

VStack(alignment: .leading, spacing: 0) {
Rectangle()
.fill(.red)
.frame(maxWidth: 97, maxHeight: 4)

Text("함께 시청된 컨텐츠")
.font(.system(size: 13, weight: .semibold))
.padding(.top, 10)
}
.padding(.horizontal, 12)
.padding(.top, 10)

LazyVGrid(columns: columns, spacing: 7) {
ForEach((0...5), id: \.self) { _ in
Image("MainPoster")
.resizable()
.cornerRadius(4)
.frame(height: 174)
}
}
.padding(.horizontal, 8)
.padding(.top, 16)
}
}
}
.preferredColorScheme(.dark)
}
}

struct ContentDetailView_Previews: PreviewProvider {
static var previews: some View {
ContentDetailView()
.previewDevice("iPhone 13 Pro")
}
}

// 상단 모서리만 둥근 모서리로 만드는 코드
// https://stackoverflow.com/questions/56760335/round-specific-corners-swiftui
struct TopRoundedRectangleImage: View {
var radius: CGFloat;
var height: CGFloat;
var imageName: String;

var body: some View {
Image(imageName)
.resizable()
.frame(height: height)
.foregroundColor(.orange)
.padding(.bottom, radius)
.cornerRadius(radius)
.padding(.bottom, -radius)
}
}