Skip to content

Commit

Permalink
✨ :: 디자인 시스템 개발
Browse files Browse the repository at this point in the history
  • Loading branch information
lsh1202 committed Jul 29, 2024
1 parent f5120fb commit 51e0b22
Show file tree
Hide file tree
Showing 109 changed files with 2,728 additions and 0 deletions.
Binary file added .DS_Store
Binary file not shown.
7 changes: 7 additions & 0 deletions .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// swift-tools-version: 5.10
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "QDS",
platforms: [.iOS(.v15), .macOS(.v12)],
products: [
.library(
name: "QDS",
targets: ["QDS"]),
],
targets: [
.target(
name: "QDS",
dependencies: [],
resources: [
.process("Resources")
]
)
]
)
Binary file added Sources/.DS_Store
Binary file not shown.
41 changes: 41 additions & 0 deletions Sources/QDS/Component/Button/QvickButton.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
//
// SwiftUIView.swift
//
//
// Created by hyk on 7/27/24.
//

import SwiftUI

struct QvickButton: View {
let action: (() -> ())?
let text: String
let background: Color

public init(action: (() -> ())? = nil, text: String, background: Color = .blue) {
self.text = text
self.background = background
self.action = action
}

var body: some View {
Button {
if let action = action {
action()
}
} label: {
RoundedRectangle(cornerRadius: 14)
.frame(width: 345, height: 50)
.foregroundStyle(background)
.overlay {
Text(text)
.font(.pretendard(.semibold, size: 17))
.foregroundStyle(.white)
}
}
}
}

#Preview {
QvickButton(text: "다음")
}
16 changes: 16 additions & 0 deletions Sources/QDS/Component/TabView/QvickTabItem.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import SwiftUI

public enum QvickTabItem: Int, CaseIterable {
case notice, home, profile

var icon: Image {
switch self {
case .notice:
Image(systemName: "bell.fill")
case .home:
Image(systemName: "house.fill")
case .profile:
Image(systemName: "person.crop.circle.fill")
}
}
}
55 changes: 55 additions & 0 deletions Sources/QDS/Component/TabView/QvickTabView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
//
// SwiftUIView.swift
//
//
// Created by hyk on 7/28/24.
//

import SwiftUI

struct QvickTabView<Content: View>: View {
@Binding var selection: QvickTabItem
let content: Content

public init(selection: Binding<QvickTabItem>, @ViewBuilder content: () -> Content) {
self._selection = selection
self.content = content()
}

var body: some View {
ZStack {
content

VStack {
Spacer()

Rectangle()
.foregroundStyle(.white)
.frame(height: 70)
.shadow(color: .black.opacity(0.05), radius: 4, y: -8)
.overlay {
HStack(spacing: 80) {
ForEach(QvickTabItem.allCases, id: \.self) { item in
Button {
self.selection = item
} label: {
item.icon
.resizable()
.scaledToFit()
.frame(height: 38)
.foregroundStyle(item == selection ? .blue : Color(red: 217/255, green: 217/255, blue: 217/255))
}
.disabled(item == selection)
}
}
}
}
}
}
}

#Preview {
QvickTabView<EmptyView>(selection: .constant(QvickTabItem.home)) {
EmptyView()
}
}
60 changes: 60 additions & 0 deletions Sources/QDS/Component/TextField/QvickTextField.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
//
// SwiftUIView.swift
//
//
// Created by hyk on 7/28/24.
//

import SwiftUI

struct QvickTextField: View {
@Binding var text: String
let prompt: String
@State var isTab: Bool = false

var body: some View {
RoundedRectangle(cornerRadius: 15)
.frame(width: 340, height: 60)
.foregroundStyle(.clear)
.overlay {
RoundedRectangle(cornerRadius: 15).stroke(isTab ? .blue : .gray)

HStack(spacing: 20) {
Image(systemName: "person.fill")
.foregroundStyle(.gray)

TextField(
text: $text,
prompt: Text(prompt).font(.pretendard(size: 14))
) {

}
.overlay {
if self.isTab {
Text(prompt)
.foregroundStyle(.blue)
.font(.pretendard(size: 11))
.padding(.horizontal, 5)
.background(Color.white)
.offset(x: -120, y: -30)
}
}
.onTapGesture {
withAnimation(.bouncy) {
self.isTab = true
}
}
.onSubmit {
withAnimation(.bouncy) {
self.isTab = false
}
}
}
.padding(.horizontal, 20)
}
}
}

#Preview {
QvickTextField(text: .constant(""), prompt: "이메일을 입력해주세요")
}
11 changes: 11 additions & 0 deletions Sources/QDS/Foundation/Color/Pallete+Ext.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import SwiftUI

extension QvickColor.Pallete {
public enum Common: QvickColor.CanPallete { case w0, w100 }
public enum Blue: QvickColor.CanPallete { case w100, w200, w300, w400, w500, w600, w700, w800, w900 }
public enum Indigo: QvickColor.CanPallete { case w100, w200, w300, w400, w500, w600, w700, w800, w900 }
public enum SkyBlue: QvickColor.CanPallete { case w100, w200, w300, w400, w500, w600, w700, w800, w900 }
public enum Green: QvickColor.CanPallete { case w100, w200, w300, w400, w500, w600, w700, w800, w900 }
public enum Yellow: QvickColor.CanPallete { case w100, w200, w300, w400, w500, w600, w700, w800, w900 }
public enum Red: QvickColor.CanPallete { case w100, w200, w300, w400, w500, w600, w700, w800, w900 }
}
43 changes: 43 additions & 0 deletions Sources/QDS/Foundation/Color/QvickColor+Ext.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import SwiftUI

@available(iOS 13.0, *)
extension QvickColor {
public protocol ColorContain {
var color: Color { get }
}

public protocol CanPallete: ColorContain {

}

public protocol CanSementic: ColorContain {
var pallete: CanPallete { get }
}
}

extension QvickColor.CanPallete {
public var color: Color {
get {
self.toColor()
}
}

private func toColor() -> Color {
let enumName = String(reflecting: self).split(separator: ".").dropLast().last
let caseName = String(describing: self)

if enumName == nil {
return .gray
}

return Color("\(enumName!)/\(caseName)", bundle: .module)
}
}

extension QvickColor.CanSementic {
public var color: Color {
get {
self.pallete.color
}
}
}
6 changes: 6 additions & 0 deletions Sources/QDS/Foundation/Color/QvickColor.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import SwiftUI

public struct QvickColor {
public enum Pallete {}
public enum Semantic {}
}
8 changes: 8 additions & 0 deletions Sources/QDS/Foundation/Image/Image+Ext.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import SwiftUI

@available(iOS 13.0, *)
public extension Image {
init(qvick: QvickImage) {
self = qvick.image
}
}
16 changes: 16 additions & 0 deletions Sources/QDS/Foundation/Image/QvickImage.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import SwiftUI

public enum QvickImage: String {
case Logo
case LogoWithText
case LogoSmall
}

@available(iOS 13.0, *)
extension QvickImage {
public var image: Image {
get {
return Image(self.rawValue, bundle: .module)
}
}
}
8 changes: 8 additions & 0 deletions Sources/QDS/Foundation/Typography/Font+Ext.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import SwiftUI

@available(iOS 13.0, *)
extension Font {
public static func pretendard( _ weight: QvickFont.Pretendard = .regular, size: CGFloat ) -> Font {
return weight.font(size: size)
}
}
40 changes: 40 additions & 0 deletions Sources/QDS/Foundation/Typography/Pretendard+Ext.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import SwiftUI

extension QvickFont.Pretendard: QvickFont.CanDefine {

public static func register() {
QvickFont.Pretendard.allCases.forEach {
guard let fontURL = Bundle.module.url(
forResource: "Pretendard-\($0.name)",
withExtension: "ttf"
),
let fontDataProvider = CGDataProvider(url: fontURL as CFURL),
let font = CGFont(fontDataProvider) else { return }
var error: Unmanaged<CFError>?
CTFontManagerRegisterGraphicsFont(font, &error)
}
}

public var name: String {
switch self {
case .thin:
"Pretendard-Thin"
case .extralight:
"Pretendard-ExtraLight"
case .light:
"Pretendard-Light"
case .regular:
"Pretendard-Regular"
case .medium:
"Pretendard-Medium"
case .semibold:
"Pretendard-SemiBold"
case .bold:
"Pretendard-Bold"
case .extrabold:
"Pretendard-ExtraBold"
case .black:
"Pretendard-Black"
}
}
}
19 changes: 19 additions & 0 deletions Sources/QDS/Foundation/Typography/QvickFont+Ext.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import SwiftUI

extension QvickFont {
public protocol CanDefine {
var name: String { get }

static func register()
}
}




@available(iOS 13.0, *)
extension QvickFont.CanDefine {
public func font( size: CGFloat ) -> Font {
return Font.custom(self.name, size: size)
}
}
7 changes: 7 additions & 0 deletions Sources/QDS/Foundation/Typography/QvickFont.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import SwiftUI

public struct QvickFont {
public enum Pretendard: CaseIterable {
case black, extrabold, bold, semibold, medium, regular, light, extralight, thin
}
}
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading

0 comments on commit 51e0b22

Please sign in to comment.