Skip to content

Commit

Permalink
Merge pull request #9 from boostcampwm-2024/style/#8-frame-sticker-bu…
Browse files Browse the repository at this point in the history
…tton-UI

[FEAT/#8] �프레임과 스티커를 담당하는 커스텀 버튼을 구현하였습니다.
  • Loading branch information
hsw1920 authored Nov 11, 2024
2 parents c447582 + 5748df3 commit 77a71af
Show file tree
Hide file tree
Showing 22 changed files with 194 additions and 8 deletions.
55 changes: 49 additions & 6 deletions PhotoGether/DesignSystem/DesignSystem.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@
objects = {

/* Begin PBXBuildFile section */
7B5951282CDB5A9500B89C85 /* Untitled.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B5951272CDB5A7B00B89C85 /* Untitled.swift */; };
60F33DFC2CE1A91300A5C26D /* PTGGrayButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 60F33DFB2CE1A91300A5C26D /* PTGGrayButton.swift */; };
60F33E072CE1E87000A5C26D /* UIImage+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 60F33E062CE1E87000A5C26D /* UIImage+.swift */; };
60F33E132CE1ED6400A5C26D /* SnapKit in Frameworks */ = {isa = PBXBuildFile; productRef = 60F33E122CE1ED6400A5C26D /* SnapKit */; };
7B59512B2CDB5BB500B89C85 /* DesignSystem.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7B59512A2CDB5BB500B89C85 /* DesignSystem.xcassets */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
60F33DFB2CE1A91300A5C26D /* PTGGrayButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PTGGrayButton.swift; sourceTree = "<group>"; };
60F33E062CE1E87000A5C26D /* UIImage+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIImage+.swift"; sourceTree = "<group>"; };
7B59511B2CDB5A7000B89C85 /* DesignSystem.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = DesignSystem.framework; sourceTree = BUILT_PRODUCTS_DIR; };
7B5951272CDB5A7B00B89C85 /* Untitled.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Untitled.swift; sourceTree = "<group>"; };
7B59512A2CDB5BB500B89C85 /* DesignSystem.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = DesignSystem.xcassets; sourceTree = "<group>"; };
/* End PBXFileReference section */

Expand All @@ -22,6 +25,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
60F33E132CE1ED6400A5C26D /* SnapKit in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -47,7 +51,8 @@
7B5951262CDB5A7700B89C85 /* DesignSystem */ = {
isa = PBXGroup;
children = (
7B5951272CDB5A7B00B89C85 /* Untitled.swift */,
60F33DFB2CE1A91300A5C26D /* PTGGrayButton.swift */,
60F33E062CE1E87000A5C26D /* UIImage+.swift */,
7B5951292CDB5AA700B89C85 /* Resource */,
);
path = DesignSystem;
Expand Down Expand Up @@ -89,6 +94,7 @@
);
name = DesignSystem;
packageProductDependencies = (
60F33E122CE1ED6400A5C26D /* SnapKit */,
);
productName = DesignSystem;
productReference = 7B59511B2CDB5A7000B89C85 /* DesignSystem.framework */;
Expand All @@ -105,6 +111,7 @@
TargetAttributes = {
7B59511A2CDB5A7000B89C85 = {
CreatedOnToolsVersion = 16.0;
LastSwiftMigration = 1600;
};
};
};
Expand All @@ -117,6 +124,9 @@
);
mainGroup = 7B5951112CDB5A7000B89C85;
minimizedProjectReferenceProxies = 1;
packageReferences = (
60F33E112CE1ED6400A5C26D /* XCRemoteSwiftPackageReference "SnapKit" */,
);
preferredProjectObjectVersion = 77;
productRefGroup = 7B59511C2CDB5A7000B89C85 /* Products */;
projectDirPath = "";
Expand All @@ -143,7 +153,8 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
7B5951282CDB5A9500B89C85 /* Untitled.swift in Sources */,
60F33E072CE1E87000A5C26D /* UIImage+.swift in Sources */,
60F33DFC2CE1A91300A5C26D /* PTGGrayButton.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -154,6 +165,7 @@
isa = XCBuildConfiguration;
buildSettings = {
BUILD_LIBRARY_FOR_DISTRIBUTION = YES;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES;
Expand All @@ -165,6 +177,7 @@
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_NSHumanReadableCopyright = "";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -176,17 +189,23 @@
PRODUCT_BUNDLE_IDENTIFIER = kr.codesquad.boostcamp9.DesignSystem;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_INSTALL_OBJC_HEADER = NO;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = 1;
};
name = Debug;
};
7B5951232CDB5A7000B89C85 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUILD_LIBRARY_FOR_DISTRIBUTION = YES;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES;
Expand All @@ -198,6 +217,7 @@
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_NSHumanReadableCopyright = "";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -209,10 +229,14 @@
PRODUCT_BUNDLE_IDENTIFIER = kr.codesquad.boostcamp9.DesignSystem;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_INSTALL_OBJC_HEADER = NO;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = 1;
};
name = Release;
};
Expand Down Expand Up @@ -363,6 +387,25 @@
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */

/* Begin XCRemoteSwiftPackageReference section */
60F33E112CE1ED6400A5C26D /* XCRemoteSwiftPackageReference "SnapKit" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/SnapKit/SnapKit";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 5.7.1;
};
};
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
60F33E122CE1ED6400A5C26D /* SnapKit */ = {
isa = XCSwiftPackageProductDependency;
package = 60F33E112CE1ED6400A5C26D /* XCRemoteSwiftPackageReference "SnapKit" */;
productName = SnapKit;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = 7B5951122CDB5A7000B89C85 /* Project object */;
}
81 changes: 81 additions & 0 deletions PhotoGether/DesignSystem/DesignSystem/PTGGrayButton.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
import UIKit
import SnapKit

public final class PTGGrayButton: UIButton {
private let type: PTGGrayButtonType
private let stackView = UIStackView()
private let grayButtonImage = UIImageView()
private let grayButtonLabel = UILabel()

public init(type: PTGGrayButtonType) {
self.type = type
super.init(frame: .zero)

addViews()
setupConstraints()
configureUI()
}

required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

private func addViews() {
addSubview(stackView)
[grayButtonImage, grayButtonLabel].forEach {
stackView.addArrangedSubview($0)
}
}

private func setupConstraints() {
stackView.snp.makeConstraints {
$0.center.equalToSuperview()
}

grayButtonImage.snp.makeConstraints {
$0.width.height.equalTo(24)
}
}

private func configureUI() {
backgroundColor = .gray85
layer.cornerRadius = 12

stackView.axis = .horizontal
stackView.distribution = .equalSpacing
stackView.spacing = 8

grayButtonImage.image = UIImage.load(name: type.image)
grayButtonImage.contentMode = .scaleAspectFit
grayButtonImage.tintColor = .white

grayButtonLabel.text = type.text
grayButtonLabel.textColor = .white
grayButtonLabel.font = .systemFont(ofSize: 16, weight: .semibold)
}
}

public extension PTGGrayButton {
enum PTGGrayButtonType {
case frame
case sticker

var text: String {
switch self {
case .frame:
return "프레임"
case .sticker:
return "스티커"
}
}

var image: String {
switch self {
case .frame:
return "frameIcon"
case .sticker:
return "stickerIcon"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "frameIcon.svg",
"idiom" : "universal"
}
],
"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.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "stickerIcon.svg",
"idiom" : "universal"
}
],
"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.
12 changes: 12 additions & 0 deletions PhotoGether/DesignSystem/DesignSystem/UIImage+.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import UIKit

public extension UIImage {
static func load(name: String) -> UIImage? {
let image = UIImage(
named: name,
in: Bundle.init(identifier: "kr.codesquad.boostcamp9.DesignSystem"),
compatibleWith: nil
)
return image
}
}
1 change: 0 additions & 1 deletion PhotoGether/DesignSystem/DesignSystem/Untitled.swift

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"originHash" : "c3373633343d643cf4275c42d63c44d7be89c54076117a694350d515b60c2b83",
"originHash" : "8ea6fb3650f67c48eee2acf4034fb317743789726eff7cdf8b901c946bd01f65",
"pins" : [
{
"identity" : "collectionconcurrencykit",
Expand All @@ -19,6 +19,15 @@
"version" : "1.8.3"
}
},
{
"identity" : "snapkit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/SnapKit/SnapKit",
"state" : {
"revision" : "2842e6e84e82eb9a8dac0100ca90d9444b0307f4",
"version" : "5.7.1"
}
},
{
"identity" : "sourcekitten",
"kind" : "remoteSourceControl",
Expand Down

0 comments on commit 77a71af

Please sign in to comment.