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] ReadShortcutView UI 구현 #533

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions HappyAnding/HappyAnding.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
F96D45BB29804057000C2441 /* EnvironmentValues+Alerter.swift in Sources */ = {isa = PBXBuildFile; fileRef = F96D45BA29804057000C2441 /* EnvironmentValues+Alerter.swift */; };
F96D45BD29816578000C2441 /* StickyHeader.swift in Sources */ = {isa = PBXBuildFile; fileRef = F96D45BC29816578000C2441 /* StickyHeader.swift */; };
F9724BBF292755E400860F8A /* Comment.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9724BBE292755E400860F8A /* Comment.swift */; };
F975C2172BD96994006CC401 /* Int+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = F975C2162BD96994006CC401 /* Int+Extension.swift */; };
F976E82C29368E0D0088BBA1 /* Version.swift in Sources */ = {isa = PBXBuildFile; fileRef = F976E82B29368E0D0088BBA1 /* Version.swift */; };
F976E85129395B350088BBA1 /* ShareExtensionViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F976E85029395B350088BBA1 /* ShareExtensionViewModel.swift */; };
F98017182BBC29A7004F2EA7 /* SCZ+Color.swift in Sources */ = {isa = PBXBuildFile; fileRef = F98017172BBC29A7004F2EA7 /* SCZ+Color.swift */; };
Expand Down Expand Up @@ -342,6 +343,11 @@
F96D45BA29804057000C2441 /* EnvironmentValues+Alerter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "EnvironmentValues+Alerter.swift"; sourceTree = "<group>"; };
F96D45BC29816578000C2441 /* StickyHeader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StickyHeader.swift; sourceTree = "<group>"; };
F9724BBE292755E400860F8A /* Comment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Comment.swift; sourceTree = "<group>"; };
F975C2122BD91321006CC401 /* SF-Compact-Rounded-Semibold.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "SF-Compact-Rounded-Semibold.otf"; sourceTree = "<group>"; };
F975C2132BD91321006CC401 /* SF-Compact-Rounded-Medium.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "SF-Compact-Rounded-Medium.otf"; sourceTree = "<group>"; };
F975C2142BD91322006CC401 /* SF-Compact-Rounded-Bold.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "SF-Compact-Rounded-Bold.otf"; sourceTree = "<group>"; };
F975C2152BD91322006CC401 /* SF-Compact-Rounded-Regular.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "SF-Compact-Rounded-Regular.otf"; sourceTree = "<group>"; };
F975C2162BD96994006CC401 /* Int+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Int+Extension.swift"; sourceTree = "<group>"; };
F976E82B29368E0D0088BBA1 /* Version.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Version.swift; sourceTree = "<group>"; };
F976E85029395B350088BBA1 /* ShareExtensionViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareExtensionViewModel.swift; sourceTree = "<group>"; };
F98017172BBC29A7004F2EA7 /* SCZ+Color.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "SCZ+Color.swift"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -642,6 +648,7 @@
F9AC2BB92935D34C00165820 /* Image+View.swift */,
A3439AFA2939B0E80043E273 /* UserDefaults+Extension.swift */,
F96D45BA29804057000C2441 /* EnvironmentValues+Alerter.swift */,
F975C2162BD96994006CC401 /* Int+Extension.swift */,
);
path = Extensions;
sourceTree = "<group>";
Expand Down Expand Up @@ -722,6 +729,7 @@
A329F70F2BCA4F8F00ED20DA /* Resources */ = {
isa = PBXGroup;
children = (
F975C2112BD91309006CC401 /* SFCompactRounded */,
A329F7102BCA4FB200ED20DA /* Pretendard */,
);
path = Resources;
Expand Down Expand Up @@ -801,6 +809,17 @@
path = SettingViews;
sourceTree = "<group>";
};
F975C2112BD91309006CC401 /* SFCompactRounded */ = {
isa = PBXGroup;
children = (
F975C2142BD91322006CC401 /* SF-Compact-Rounded-Bold.otf */,
F975C2132BD91321006CC401 /* SF-Compact-Rounded-Medium.otf */,
F975C2152BD91322006CC401 /* SF-Compact-Rounded-Regular.otf */,
F975C2122BD91321006CC401 /* SF-Compact-Rounded-Semibold.otf */,
);
path = SFCompactRounded;
sourceTree = "<group>";
};
F9DB8ECB293B30EC00516CE1 /* Recovered References */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -937,6 +956,7 @@
packageReferences = (
F94B435B2907B19A00987819 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */,
4D6A9EFD29A36E9C00D02522 /* XCRemoteSwiftPackageReference "WrappingHStack" */,
F975C2182BDA3A70006CC401 /* XCRemoteSwiftPackageReference "swiftui-introspect" */,
);
productRefGroup = 87E99C6B28F94EA6009B691F /* Products */;
projectDirPath = "";
Expand Down Expand Up @@ -1070,6 +1090,7 @@
87E99C7028F94EA6009B691F /* ShortcutTabView.swift in Sources */,
F99569182901DC4D0060AAEF /* UIFont+Extension.swift in Sources */,
F91A72C32999160E00CA135A /* Alerter.swift in Sources */,
F975C2172BD96994006CC401 /* Int+Extension.swift in Sources */,
A3D348552BD1233000DE814C /* View+Font.swift in Sources */,
87E99CAD28FFF261009B691F /* ReadShortcutView.swift in Sources */,
F930E0002BBD51EC003C2686 /* Seal.swift in Sources */,
Expand Down Expand Up @@ -1610,6 +1631,14 @@
minimumVersion = 10.0.0;
};
};
F975C2182BDA3A70006CC401 /* XCRemoteSwiftPackageReference "swiftui-introspect" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/siteline/swiftui-introspect";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 1.1.3;
};
};
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
Expand Down
24 changes: 24 additions & 0 deletions HappyAnding/HappyAnding/Assets.xcassets/app.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"images" : [
{
"filename" : "app.svg",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}
3 changes: 3 additions & 0 deletions HappyAnding/HappyAnding/Assets.xcassets/app.imageset/app.svg
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
@@ -0,0 +1,24 @@
{
"images" : [
{
"filename" : "appLarge.svg",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}
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
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "profileIcon.svg",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"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.
17 changes: 17 additions & 0 deletions HappyAnding/HappyAnding/Extensions/Int+Extension.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// Int+Extension.swift
// HappyAnding
//
// Created by JeonJimin on 4/25/24.
//

import Foundation

extension Int {
/// Int 타입의 숫자를 받아서 천 단위로 콤마를 추가한 문자열을 반환
func formatNumber() -> String {
let formatter = NumberFormatter()
formatter.numberStyle = .decimal
return formatter.string(from: NSNumber(value: self)) ?? ""
}
}
8 changes: 8 additions & 0 deletions HappyAnding/HappyAnding/Extensions/SCZ+Color.swift
Original file line number Diff line number Diff line change
Expand Up @@ -582,4 +582,12 @@ extension SCZColor {
static let opacity16 = Color(hexString: "DEE7FF")
static let opacity08 = Color(hexString: "EFF3FF")
}

struct SCZRed {
static let dangerouslyRed = Color(hexString: "DD0008")
static let red = Color(hexString: "FF453A")
}

static let systemWhite = Color(hexString: "FFFFFF")
static let systemBlack = Color(hexString: "000000")
}
74 changes: 62 additions & 12 deletions HappyAnding/HappyAnding/Extensions/String/String+Date.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,67 @@ extension String {

func getPostDateFormat() -> String? {
let inputFormatter = DateFormatter()
inputFormatter.dateFormat = "yyyyMMddHHmmss"

if let date = inputFormatter.date(from: self) {
let outputFormatter = DateFormatter()
outputFormatter.locale = Locale(identifier: "ko_KR")
outputFormatter.dateFormat = "M월 d일 a h시 m분"

let output = outputFormatter.string(from: date)
return output
} else {
return nil
}
inputFormatter.dateFormat = "yyyyMMddHHmmss"

if let date = inputFormatter.date(from: self) {
let outputFormatter = DateFormatter()
outputFormatter.locale = Locale(identifier: "ko_KR")
outputFormatter.dateFormat = "M월 d일 a h시 m분"

let output = outputFormatter.string(from: date)
return output
} else {
return nil
}
}
func getVersionDateFormat() -> String? {
let inputFormatter = DateFormatter()
inputFormatter.dateFormat = "yyyyMMddHHmmss"

if let date = inputFormatter.date(from: self) {
let outputFormatter = DateFormatter()
outputFormatter.locale = Locale(identifier: "ko_KR")
outputFormatter.dateFormat = "yyyy년 M월 d일"

let output = outputFormatter.string(from: date)
return output
} else {
return nil
}
}

func getCommentDateFormat() -> String {
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyyMMddHHmmss"

let commentDateFormatter = DateFormatter()
commentDateFormatter.dateFormat = "yyyy.MM.dd"

guard let date = dateFormatter.date(from: self) else {
return ""
}

let calendar = Calendar.current
let currentDate = Date()

let difference = calendar.dateComponents([.year, .month, .weekOfYear, .day, .hour, .minute], from: date, to: currentDate)

if let years = difference.year, years > 0 {
return commentDateFormatter.string(from: date)
} else if let months = difference.month, months >= 11 {
return commentDateFormatter.string(from: date)
} else if let months = difference.month, months > 0 {
return "\(months)개월 전"
} else if let weeks = difference.weekOfYear, weeks > 0 {
return "\(weeks)주 전"
} else if let days = difference.day, days > 0 {
return "\(days)일 전"
} else if let hours = difference.hour, hours > 0 {
return "\(hours)시간 전"
} else if let minutes = difference.minute, minutes > 0 {
return "\(minutes)분 전"
} else {
return "방금 전"
}
}
}
11 changes: 11 additions & 0 deletions HappyAnding/HappyAnding/Extensions/View/View+Font.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ enum Pretendard: String {
case bold = "Pretendard-Bold"
}

enum SFCompactRounded: String {
case regular = "SF-Compact-Rounded-Regular"
case medium = "SF-Compact-Rounded-Medium"
case semiBold = "SF-Compact-Rounded-Semibold"
case bold = "SF-Compact-Rounded-Bold"
}

///Pretendard 폰트를 기존 modifier와 같이 사용할 수 있게 해 주는 Extension
///사용 예시
///Text("단축어").largeTitle()
Expand Down Expand Up @@ -55,6 +62,10 @@ extension View {
func customPretendard(fontName: Pretendard, size: CGFloat) -> some View {
self.modifier(CustomFontStyle(fontName: fontName.rawValue, size: size))
}

func customSFCompactRounded(fontName: SFCompactRounded, size: CGFloat) -> some View {
self.modifier(CustomFontStyle(fontName: fontName.rawValue, size: size))
}
}

struct CustomFontStyle: ViewModifier {
Expand Down
21 changes: 21 additions & 0 deletions HappyAnding/HappyAnding/Extensions/View/View+Shape.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ extension View {
)
.clipShape(RoundedRectangle(cornerRadius: cornerRadius))
}

func roundedBackground(background: Color) -> some View {
self
.padding(.horizontal, 10)
.padding(.vertical, 8)
.background(background)
.roundedBorder(cornerRadius: 16, color: Color.white.opacity(0.12), isNormalBlend: true)
}
}


Expand All @@ -46,3 +54,16 @@ struct RoundedCorner: Shape {
return Path(path.cgPath)
}
}

//MARK: - 삼각형
/// 삼각형 모양을 그리는 경우에 사용합니다.
struct Triangle: Shape {
func path(in rect: CGRect) -> Path {
Path { path in
path.move(to: CGPoint(x: rect.midX, y: rect.minY))
path.addLine(to: CGPoint(x: rect.maxX, y: rect.maxY))
path.addLine(to: CGPoint(x: rect.minX, y: rect.maxY))
path.closeSubpath()
}
}
}
20 changes: 19 additions & 1 deletion HappyAnding/HappyAnding/Extensions/View/View+UIFont.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,27 @@ extension View {
func smallShortcutIcon() -> some View {
ModifiedContent(content: self, modifier: FontWithLineHeight(font: .smallShortcutIcon, lineHeight: 20))
}
func regular16() -> some View {
ModifiedContent(content: self, modifier: FontWithLineHeight(font: UIFont(name: Pretendard.regular.rawValue, size: 16) ?? UIFont.systemFont(ofSize: 16), lineHeight: 24))
}
func medium16() -> some View {
ModifiedContent(content: self, modifier: FontWithLineHeight(font: UIFont(name: Pretendard.medium.rawValue, size: 16) ?? UIFont.systemFont(ofSize: 16), lineHeight: 24))
}
func medium17() -> some View {
ModifiedContent(content: self, modifier: FontWithLineHeight(font: UIFont(name: Pretendard.medium.rawValue, size: 17) ?? UIFont.systemFont(ofSize: 17), lineHeight: 24))
}
func semiBold17() -> some View {
ModifiedContent(content: self, modifier: FontWithLineHeight(font: UIFont(name: Pretendard.semiBold.rawValue, size: 17) ?? UIFont.systemFont(ofSize: 17), lineHeight: 24))
}
func numRegular16() -> some View {
ModifiedContent(content: self, modifier: FontWithLineHeight(font: UIFont(name: SFCompactRounded.regular.rawValue, size: 16) ?? UIFont.systemFont(ofSize: 16), lineHeight: 24))
}

func descriptionReadable() -> some View {
ModifiedContent(content: self, modifier: FontWithLineHeight(font: UIFont(name: Pretendard.regular.rawValue, size: 16) ?? UIFont.systemFont(ofSize: 16), lineHeight: 24))
}
}


// MARK: - View Modifier
/**
자간을 위한 View Modifier입니다.
Expand Down
Loading