Skip to content

Commit

Permalink
Merge pull request #101 from DeveloperAcademy-POSTECH/release
Browse files Browse the repository at this point in the history
[Release] version 1.0.3
  • Loading branch information
JIWON1923 committed Feb 26, 2023
2 parents 3e09700 + cd83c18 commit cabca43
Show file tree
Hide file tree
Showing 18 changed files with 546 additions and 201 deletions.
36 changes: 26 additions & 10 deletions Record.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,18 @@
8715A798285531AB001AB4F5 /* SearchView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8715A797285531AB001AB4F5 /* SearchView.swift */; };
8715A79B2855479E001AB4F5 /* MusicAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8715A79A2855479E001AB4F5 /* MusicAPI.swift */; };
8715A79D2855B5AC001AB4F5 /* Colors.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 8715A79C2855B5AC001AB4F5 /* Colors.xcassets */; };
8786B2F129AA547C000B46A1 /* CDPlayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8786B2F029AA547C000B46A1 /* CDPlayer.swift */; };
8786B2F329AA5726000B46A1 /* CDList.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8786B2F229AA5726000B46A1 /* CDList.swift */; };
8786B2F529AA5CED000B46A1 /* MusicInformation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8786B2F429AA5CED000B46A1 /* MusicInformation.swift */; };
87A0D9B1285BAEF8006D0D3B /* Persistence.swift in Sources */ = {isa = PBXBuildFile; fileRef = 87A0D9B0285BAEF8006D0D3B /* Persistence.swift */; };
87A0D9B4285BAF42006D0D3B /* Record.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 87A0D9B2285BAF42006D0D3B /* Record.xcdatamodeld */; };
87B6E3CD28EC9764002D579A /* Color+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 87B6E3CC28EC9764002D579A /* Color+Extensions.swift */; };
87B6E3CF28EC978D002D579A /* Font+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 87B6E3CE28EC978D002D579A /* Font+Extensions.swift */; };
87B6E3D128EC97B0002D579A /* View+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 87B6E3D028EC97B0002D579A /* View+Extensions.swift */; };
87B6E3D328EC97CE002D579A /* UIScreen+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 87B6E3D228EC97CE002D579A /* UIScreen+Extensions.swift */; };
87C429EB28E37594009B6DA6 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 87C429EA28E37594009B6DA6 /* LaunchScreen.storyboard */; };
87D686F229A63B9F00E3707F /* EmptyCDListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 87D686F129A63B9F00E3707F /* EmptyCDListView.swift */; };
87D686F429A6768900E3707F /* FramePreferenceKey.swift in Sources */ = {isa = PBXBuildFile; fileRef = 87D686F329A6768900E3707F /* FramePreferenceKey.swift */; };
87E96F4928DF93C4007D167E /* FirstPage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 87E96F4828DF93C4007D167E /* FirstPage.swift */; };
87E96F4B28DF93CC007D167E /* SecondPage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 87E96F4A28DF93CC007D167E /* SecondPage.swift */; };
87E96F4D28DF940A007D167E /* ThirdPage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 87E96F4C28DF940A007D167E /* ThirdPage.swift */; };
Expand All @@ -34,9 +39,8 @@
A01413222855F4E60000EA59 /* HomeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A01413212855F4E60000EA59 /* HomeView.swift */; };
A0AA39BB285A4936009EE3EA /* OnboardingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A0AA39BA285A4936009EE3EA /* OnboardingView.swift */; };
A0AA39BF285AF643009EE3EA /* FourthPage.swift in Sources */ = {isa = PBXBuildFile; fileRef = A0AA39BE285AF643009EE3EA /* FourthPage.swift */; };
B277EC152859A671001A97B1 /* Carousel.swift in Sources */ = {isa = PBXBuildFile; fileRef = B277EC142859A671001A97B1 /* Carousel.swift */; };
B277EC172859A679001A97B1 /* CdListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B277EC162859A679001A97B1 /* CdListView.swift */; };
B29723B0285B192C0065FD36 /* SnapCarouselView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B29723AF285B192C0065FD36 /* SnapCarouselView.swift */; };
F9BA11F329A499D500176807 /* MarqueeTextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9BA11F229A499D500176807 /* MarqueeTextView.swift */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand All @@ -54,13 +58,18 @@
8715A797285531AB001AB4F5 /* SearchView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchView.swift; sourceTree = "<group>"; };
8715A79A2855479E001AB4F5 /* MusicAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MusicAPI.swift; sourceTree = "<group>"; };
8715A79C2855B5AC001AB4F5 /* Colors.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Colors.xcassets; sourceTree = "<group>"; };
8786B2F029AA547C000B46A1 /* CDPlayer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CDPlayer.swift; sourceTree = "<group>"; };
8786B2F229AA5726000B46A1 /* CDList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CDList.swift; sourceTree = "<group>"; };
8786B2F429AA5CED000B46A1 /* MusicInformation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MusicInformation.swift; sourceTree = "<group>"; };
87A0D9B0285BAEF8006D0D3B /* Persistence.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Persistence.swift; sourceTree = "<group>"; };
87A0D9B3285BAF42006D0D3B /* Recored.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = Recored.xcdatamodel; sourceTree = "<group>"; };
87B6E3CC28EC9764002D579A /* Color+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Color+Extensions.swift"; sourceTree = "<group>"; };
87B6E3CE28EC978D002D579A /* Font+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Font+Extensions.swift"; sourceTree = "<group>"; };
87B6E3D028EC97B0002D579A /* View+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "View+Extensions.swift"; sourceTree = "<group>"; };
87B6E3D228EC97CE002D579A /* UIScreen+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIScreen+Extensions.swift"; sourceTree = "<group>"; };
87C429EA28E37594009B6DA6 /* LaunchScreen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = LaunchScreen.storyboard; sourceTree = "<group>"; };
87D686F129A63B9F00E3707F /* EmptyCDListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmptyCDListView.swift; sourceTree = "<group>"; };
87D686F329A6768900E3707F /* FramePreferenceKey.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FramePreferenceKey.swift; sourceTree = "<group>"; };
87E96F4828DF93C4007D167E /* FirstPage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FirstPage.swift; sourceTree = "<group>"; };
87E96F4A28DF93CC007D167E /* SecondPage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecondPage.swift; sourceTree = "<group>"; };
87E96F4C28DF940A007D167E /* ThirdPage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThirdPage.swift; sourceTree = "<group>"; };
Expand All @@ -69,9 +78,8 @@
A01413212855F4E60000EA59 /* HomeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeView.swift; sourceTree = "<group>"; };
A0AA39BA285A4936009EE3EA /* OnboardingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingView.swift; sourceTree = "<group>"; };
A0AA39BE285AF643009EE3EA /* FourthPage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FourthPage.swift; sourceTree = "<group>"; };
B277EC142859A671001A97B1 /* Carousel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Carousel.swift; sourceTree = "<group>"; };
B277EC162859A679001A97B1 /* CdListView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CdListView.swift; sourceTree = "<group>"; };
B29723AF285B192C0065FD36 /* SnapCarouselView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SnapCarouselView.swift; sourceTree = "<group>"; };
F9BA11F229A499D500176807 /* MarqueeTextView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MarqueeTextView.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -169,8 +177,11 @@
isa = PBXGroup;
children = (
B277EC162859A679001A97B1 /* CdListView.swift */,
B29723AF285B192C0065FD36 /* SnapCarouselView.swift */,
B277EC142859A671001A97B1 /* Carousel.swift */,
87D686F129A63B9F00E3707F /* EmptyCDListView.swift */,
8786B2F429AA5CED000B46A1 /* MusicInformation.swift */,
8786B2F229AA5726000B46A1 /* CDList.swift */,
8786B2F029AA547C000B46A1 /* CDPlayer.swift */,
F9BA11F229A499D500176807 /* MarqueeTextView.swift */,
);
path = CDListView;
sourceTree = "<group>";
Expand Down Expand Up @@ -215,6 +226,7 @@
isa = PBXGroup;
children = (
87F1956C295FED74004A1CAF /* URLImage.swift */,
87D686F329A6768900E3707F /* FramePreferenceKey.swift */,
);
path = Components;
sourceTree = "<group>";
Expand Down Expand Up @@ -292,22 +304,26 @@
buildActionMask = 2147483647;
files = (
B277EC172859A679001A97B1 /* CdListView.swift in Sources */,
8786B2F129AA547C000B46A1 /* CDPlayer.swift in Sources */,
8786B2F529AA5CED000B46A1 /* MusicInformation.swift in Sources */,
F9BA11F329A499D500176807 /* MarqueeTextView.swift in Sources */,
87E96F4928DF93C4007D167E /* FirstPage.swift in Sources */,
87E96F4B28DF93CC007D167E /* SecondPage.swift in Sources */,
A01413222855F4E60000EA59 /* HomeView.swift in Sources */,
3D49B5B0285A41570054FDED /* PhotoModalView.swift in Sources */,
87D686F229A63B9F00E3707F /* EmptyCDListView.swift in Sources */,
8786B2F329AA5726000B46A1 /* CDList.swift in Sources */,
3D593E472858530B00E481C7 /* WritingModalView.swift in Sources */,
87B6E3CF28EC978D002D579A /* Font+Extensions.swift in Sources */,
B29723B0285B192C0065FD36 /* SnapCarouselView.swift in Sources */,
87E96F4D28DF940A007D167E /* ThirdPage.swift in Sources */,
87FB281D285A04680036A5BB /* Screenshot.swift in Sources */,
87F1956D295FED74004A1CAF /* URLImage.swift in Sources */,
87D686F429A6768900E3707F /* FramePreferenceKey.swift in Sources */,
8715A79B2855479E001AB4F5 /* MusicAPI.swift in Sources */,
87B6E3CD28EC9764002D579A /* Color+Extensions.swift in Sources */,
87A0D9B4285BAF42006D0D3B /* Record.xcdatamodeld in Sources */,
A0AA39BB285A4936009EE3EA /* OnboardingView.swift in Sources */,
A0AA39BF285AF643009EE3EA /* FourthPage.swift in Sources */,
B277EC152859A671001A97B1 /* Carousel.swift in Sources */,
A01413222855F4E60000EA59 /* HomeView.swift in Sources */,
87B6E3D328EC97CE002D579A /* UIScreen+Extensions.swift in Sources */,
3D49B5AE285A02B50054FDED /* StoryModalView.swift in Sources */,
Expand Down Expand Up @@ -465,7 +481,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.2;
MARKETING_VERSION = 1.0.3;
PRODUCT_BUNDLE_IDENTIFIER = com.ios.larasy.record;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down Expand Up @@ -504,7 +520,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.2;
MARKETING_VERSION = 1.0.3;
PRODUCT_BUNDLE_IDENTIFIER = com.ios.larasy.record;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
48 changes: 48 additions & 0 deletions Record/Extensions/Font+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,51 @@ extension Font {
return size
}
}

extension UIFont {
static func customTitle3() -> UIFont {
return .systemFont(ofSize: 20 * setSize(), weight: .regular)
}

static func setSize() -> Double {
let height = UIScreen.screenHeight
var size = 1.0

switch height {
case 480.0: //Iphone 3,4S => 3.5 inch
size = 0.85
break
case 568.0: //iphone 5, SE => 4 inch
size = 0.9
break
case 667.0: //iphone 6, 6s, 7, 8 => 4.7 inch
size = 0.9
break
case 736.0: //iphone 6s+ 6+, 7+, 8+ => 5.5 inch
size = 0.95
break
case 812.0: //iphone X, XS => 5.8 inch, 13 mini, 12, mini
size = 0.98
break
case 844.0: // iphone 14, iphone 13 pro, iphone 13, 12 pro, 12
size = 1
break
case 852.0: // iphone 14 pro
size = 1
break
case 926.0: // iphone 14 plus, iphone 13 pro max, 12 pro max
size = 1.05
break
case 896.0: //iphone XR => 6.1 inch // iphone XS MAX => 6.5 inch, 11 pro max, 11
size = 1.05
break
case 932.0: // iPhone14 Pro Max
size = 1.08
break
default:
size = 1
break
}
return size
}
}
16 changes: 16 additions & 0 deletions Record/Extensions/View+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,19 @@ extension View {
}
}
}


extension View {

func frame(perform: @escaping (CGRect) -> Void) -> some View {
background(
GeometryReader {
Color.clear
.preference(key: FramePreferenceKey.self, value: $0.frame(in: .global))
}
)
.onPreferenceChange(FramePreferenceKey.self) { value in
DispatchQueue.main.async { perform(value) }
}
}
}
142 changes: 142 additions & 0 deletions Record/Views/CDListView/CDList.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
//
// CDList.swift
// Record
//
// Created by 이지원 on 2023/02/25.
//

import SwiftUI

/**
사용자가 저장한 모든 CD(이야기)를 캐러셀 형태로 보여주는 뷰 입니다.
- Parameters:
- items: Content 리스트 (core data에 저장된 데이터)
- currentIndex: 사용자가 선택한 CD index 번호
*/

struct CDList: View {

@Binding var items: [Content]
@Binding var currentIndex: Int

// MARK: Carousel Animaion
@State private var pointX: CGFloat = 0
@State private var size: CGSize = .zero
@State private var isDragging = false

@GestureState private var offsetState: CGSize = .zero

private let spacing: CGFloat = -UIScreen.getWidth(90)
private let cdSize: CGFloat = UIScreen.getWidth(200)

private var firstItemPositionX: CGFloat {
(cdSize * CGFloat(max(0, items.count - 1)) + spacing * CGFloat(max(0, items.count - 1))) / 2 + size.width / 2
}

var body: some View {

ZStack {

GeometryReader { proxy in

HStack(spacing: spacing) {

ForEach (items.indices, id: \.self) { i in

// MARK: - CD
ZStack {

URLImage(urlString: items[i].albumArt ?? "")
.aspectRatio(contentMode: .fill)
.clipShape(Circle())
.shadow(color: Color(.gray), radius: 4, x: 0, y: 4)

Circle()
.frame(width: UIScreen.getWidth(40), height: UIScreen.getHeight(40))
.foregroundColor(.background)
.overlay(
Circle()
.stroke(.background, lineWidth: 0.1)
.shadow(color: .titleDarkgray, radius: 2, x: 3, y: 3)
)
}
.frame(width: cdSize, height: cdSize)
.scaleEffect(max(1.0 - abs(distance(i)) * 0.25, 0.0001))
.zIndex(1.0 - abs(distance(i) * 0.1))
.opacity(1.0 - abs(distance(i) * 0.3))
.frame { value in
let range = cdSize + spacing

if isDragging {
var ratio: CGFloat {
switch value.origin.x {
case (proxy.size.width / 2 - cdSize / 2)...(proxy.size.width + cdSize / 2 + spacing):
let offset = (proxy.size.width + cdSize / 2 + spacing) - (proxy.size.width / 2) - value.origin.x
return offset / range

case (spacing / 2)..<(proxy.size.width / 2 - cdSize / 2):
let offset = ((proxy.size.width - cdSize) / 2) - value.origin.x
return 1 - offset / range

default:
return 0
}
}

withAnimation {
if 0.5 < ratio {
currentIndex = i
}
}
}
}
.onTapGesture {
withAnimation {
self.currentIndex = i
pointX = -(CGFloat(currentIndex) * cdSize + (CGFloat(currentIndex) * spacing))
}
}
}
}
.position(x: firstItemPositionX + pointX + offsetState.width, y: proxy.size.height / 2)
.task {
size = proxy.size
}
}
}
.onAppear {
withAnimation {
pointX = -(CGFloat(currentIndex) * cdSize + (CGFloat(currentIndex) * spacing))
}
}
.gesture(
DragGesture()
.updating($offsetState) { currentState, gestureState, transaction in
gestureState = currentState.translation
}
.onChanged { value in
isDragging = true
}

.onEnded { value in

isDragging = false
pointX += value.translation.width

withAnimation(.spring(response: 0.5, dampingFraction: 0.9, blendDuration: 0)) {
pointX = -(CGFloat(currentIndex) * cdSize + (CGFloat(currentIndex) * spacing))
}

let haptic = UIImpactFeedbackGenerator(style: .soft)
haptic.impactOccurred()
}
)
.frame(height: cdSize)

}

private func distance(_ index: Int) -> Double {
return Double(currentIndex - index)
}
}
Loading

0 comments on commit cabca43

Please sign in to comment.