Skip to content

Commit

Permalink
[Chore] #253 - unwrapped custom font optionals
Browse files Browse the repository at this point in the history
  • Loading branch information
seongmin221 committed May 4, 2024
1 parent f4cf3cc commit 91fe37b
Show file tree
Hide file tree
Showing 43 changed files with 77 additions and 92 deletions.
4 changes: 0 additions & 4 deletions GEON-PPANG-iOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@
3EE1A9132AA0873500021F9D /* UrlLiteral.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EE1A9122AA0873500021F9D /* UrlLiteral.swift */; };
3EE343142A6440EB0010C187 /* UICollectionViewCell+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EE343132A6440EB0010C187 /* UICollectionViewCell+.swift */; };
3EE466A42A69CAC6007C3C77 /* SimpleBakeryModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EE466A32A69CAC6007C3C77 /* SimpleBakeryModel.swift */; };
3EF9F8922BBCEDDC00F3E366 /* ImageDummy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EF9F8912BBCEDDC00F3E366 /* ImageDummy.swift */; };
3EF9F8A62BBD116600F3E366 /* DummyRequestDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EF9F8A52BBD116600F3E366 /* DummyRequestDTO.swift */; };
3EF9F8A82BBD116F00F3E366 /* DummyResDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EF9F8A72BBD116F00F3E366 /* DummyResDTO.swift */; };
3EF9F8AA2BBD117400F3E366 /* DummyRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EF9F8A92BBD117400F3E366 /* DummyRepository.swift */; };
Expand Down Expand Up @@ -464,7 +463,6 @@
3EE1A9122AA0873500021F9D /* UrlLiteral.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UrlLiteral.swift; sourceTree = "<group>"; };
3EE343132A6440EB0010C187 /* UICollectionViewCell+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UICollectionViewCell+.swift"; sourceTree = "<group>"; };
3EE466A32A69CAC6007C3C77 /* SimpleBakeryModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SimpleBakeryModel.swift; sourceTree = "<group>"; };
3EF9F8912BBCEDDC00F3E366 /* ImageDummy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageDummy.swift; sourceTree = "<group>"; };
3EF9F8A52BBD116600F3E366 /* DummyRequestDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DummyRequestDTO.swift; sourceTree = "<group>"; };
3EF9F8A72BBD116F00F3E366 /* DummyResDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DummyResDTO.swift; sourceTree = "<group>"; };
3EF9F8A92BBD117400F3E366 /* DummyRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DummyRepository.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1644,7 +1642,6 @@
isa = PBXGroup;
children = (
0905561F2A51DB2C00752067 /* UIImage+.swift */,
3EF9F8912BBCEDDC00F3E366 /* ImageDummy.swift */,
);
path = Assets;
sourceTree = "<group>";
Expand Down Expand Up @@ -2104,7 +2101,6 @@
097716EB2AA57713001EE6D5 /* LayoutUtils.swift in Sources */,
DF697C032A671A6D008CE4CF /* BakeryDetailCollectionViewHeader.swift in Sources */,
DFB585FB2A5F565F0077D272 /* BreadTypeStackView.swift in Sources */,
3EF9F8922BBCEDDC00F3E366 /* ImageDummy.swift in Sources */,
DFB585FD2A5FEA0E0077D272 /* InfoCollectionViewCell.swift in Sources */,
09FD47DD2A5E57F2002020BD /* MyReviewsViewController.swift in Sources */,
3EA2E1EB2A542151003516A3 /* SizeLiteral.swift in Sources */,
Expand Down
11 changes: 0 additions & 11 deletions GEON-PPANG-iOS/Core/DesignSystem/Source/Assets/ImageDummy.swift

This file was deleted.

24 changes: 12 additions & 12 deletions GEON-PPANG-iOS/Core/DesignSystem/Source/Fonts/UIFont+.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,27 @@ extension UIFont {
return UIFont(name: "Pretendard-Medium", size: size)!
}

static let largeTitle = UIFont(name: "Pretendard-Bold", size: 32.0)
static let largeTitle: UIFont = .pretendardBold(32.0)

static let title1 = UIFont(name: "Pretendard-Bold", size: 26.0)
static let title1: UIFont = .pretendardBold(26.0)

static let title2 = UIFont(name: "Pretendard-Bold", size: 20.0)
static let title2: UIFont = .pretendardBold(20.0)

static let headLine = UIFont(name: "Pretendard-Medium", size: 18.0)
static let headLine: UIFont = .pretendardMedium(18.0)

static let subHead = UIFont(name: "Pretendard-Medium", size: 15.0)
static let subHead: UIFont = .pretendardMedium(15.0)

static let bodyB1 = UIFont(name: "Pretendard-Bold", size: 17.0)
static let bodyB1: UIFont = .pretendardBold(17.0)

static let bodyM1 = UIFont(name: "Pretendard-Medium", size: 17.0)
static let bodyM1: UIFont = .pretendardMedium(17.0)

static let bodyB2 = UIFont(name: "Pretendard-Bold", size: 14.0)
static let bodyB2: UIFont = .pretendardBold(14.0)

static let bodyM2 = UIFont(name: "Pretendard-Medium", size: 14.0)
static let bodyM2: UIFont = .pretendardMedium(14.0)

static let captionB1 = UIFont(name: "Pretendard-Bold", size: 13.0)
static let captionB1: UIFont = .pretendardBold(13.0)

static let captionM1 = UIFont(name: "Pretendard-Medium", size: 13.0)
static let captionM1: UIFont = .pretendardMedium(13.0)

static let captionM2 = UIFont(name: "Pretendard-Medium", size: 11.0)
static let captionM2: UIFont = .pretendardMedium(11.0)
}
4 changes: 2 additions & 2 deletions GEON-PPANG-iOS/Global/Extensions/UI/TabBar+.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ extension UITabBar {
UITabBar.appearance().backgroundImage = UIImage()
UITabBar.appearance().backgroundColor = UIColor.white
UITabBarItem.appearance().titlePositionAdjustment.vertical = -5
UITabBarItem.appearance().setTitleTextAttributes([NSAttributedString.Key.font: UIFont.captionB1!,
UITabBarItem.appearance().setTitleTextAttributes([NSAttributedString.Key.font: UIFont.captionB1,
NSAttributedString.Key.foregroundColor: UIColor.gbbGray400],
for: .normal)
UITabBarItem.appearance().setTitleTextAttributes([NSAttributedString.Key.font: UIFont.captionB1!,
UITabBarItem.appearance().setTitleTextAttributes([NSAttributedString.Key.font: UIFont.captionB1,
NSAttributedString.Key.foregroundColor: UIColor.gbbMain3],
for: .selected)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ final class BookmarkButton: UIButton {
if count == 0 {
configuration?.title = ""
} else {
configuration?.attributedTitle = AttributedString("\(count)", attributes: AttributeContainer([.font: UIFont.bodyB2!]))
configuration?.attributedTitle = AttributedString("\(count)", attributes: AttributeContainer([.font: UIFont.bodyB2]))
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ final class CommonButton: UIButton {
switch color {
case .gbbMain2, .gbbGray700: setTitleColor(.gbbGray100, for: .normal)
case .clear:
self.titleLabel?.font = .bodyB1!
self.titleLabel?.font = .bodyB1
setTitleColor(.gbbGray400, for: .normal)
default:
setTitleColor(.gbbGray400, for: .normal)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ final class IconWithTextView: UIButton {

func configureListUI(text: String) {

self.configuration?.attributedTitle = AttributedString(text, attributes: AttributeContainer([.font: UIFont.captionM1!, .foregroundColor: UIColor.gbbGray400]))
self.configuration?.attributedTitle = AttributedString(text, attributes: AttributeContainer([.font: UIFont.captionM1, .foregroundColor: UIColor.gbbGray400]))

}

func configureHomeCell(count: Int) {

self.configuration?.attributedTitle = AttributedString("(\(count))", attributes: AttributeContainer([.font: UIFont.captionB1!, .foregroundColor: UIColor.gbbGray400]))
self.configuration?.attributedTitle = AttributedString("(\(count))", attributes: AttributeContainer([.font: UIFont.captionB1, .foregroundColor: UIColor.gbbGray400]))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ final class BreadTypeStackView: UIStackView {

[glutenFreeChip, veganBreadChip, nutFreeChip, subSugarChip].enumerated().forEach { index, chip in
chip.do {
$0.basic(text: labeling[index], font: .captionM1!, color: .gbbPoint1)
$0.basic(text: labeling[index], font: .captionM1, color: .gbbPoint1)
$0.makeCornerRound(radius: 3)
$0.makeBorder(width: 0.5, color: .gbbPoint1)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ final class IconLabelStackView: UIStackView {
private var labelFont: UIFont {
switch iconType {
case .bookmark, .review, .basic:
return .captionB1!
return .captionB1
case .notice:
return .captionM1!
return .captionM1
}
}
private var labelColor: UIColor {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ final class ReviewCategoryStackView: UIStackView {
[deliciousChip, zerowasteChip, specialChip, kindChip].enumerated().forEach { index, chip in
chip.do {
$0.backgroundColor = .gbbPoint2
$0.basic(text: labeling[index], font: .captionM1!, color: .gbbPoint1)
$0.basic(text: labeling[index], font: .captionM1, color: .gbbPoint1)
$0.makeCornerRound(radius: 3)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ final class CommonTextView: UIView {
private func setUI(type: SignInPropertyType) {

titleLabel.do {
$0.basic(font: .bodyB2!, color: .gbbGray400)
$0.basic(font: .bodyB2, color: .gbbGray400)
$0.text = type.title
}

Expand Down Expand Up @@ -102,7 +102,7 @@ final class CommonTextView: UIView {

titleLabel.textColor = isValid ? .gbbError: .gbbMain3
checkLabel.basic(text: message,
font: .captionM1!,
font: .captionM1,
color: isValid ? .gbbError: .gbbMain3)
commonTextField.layer.borderColor = isValid ? UIColor.gbbError.cgColor : UIColor.gbbMain3.cgColor
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@ final class SearchTextField: UITextField {

switch viewType {
case .search:
setPlaceholder(color: .gbbGray300, font: .bodyM1!)
setPlaceholder(color: .gbbGray300, font: .bodyM1)
leftView = searchButton
leftViewMode = .always
rightView = clearButton
rightViewMode = .whileEditing
case .home:
setPlaceholder(color: .gbbGray300, font: .subHead!)
setPlaceholder(color: .gbbGray300, font: .subHead)
setLeftPadding(amount: 0)
rightView = searchButton
rightViewMode = .always
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ final class SignInTextField: UITextField {

$0.makeCornerRound(radius: 10)
$0.makeBorder(width: 1, color: .clear)
$0.setPlaceholder(color: .gbbGray300, font: .headLine!)
$0.setPlaceholder(color: .gbbGray300, font: .headLine)
}
}

Expand Down Expand Up @@ -88,7 +88,7 @@ final class SignInTextField: UITextField {
configuration.baseForegroundColor = .gbbWhite
configuration.cornerStyle = .capsule
configuration.attributedTitle = AttributedString("중복확인",
attributes: AttributeContainer([.font: UIFont.captionM1!]))
attributes: AttributeContainer([.font: UIFont.captionM1]))
configuration.contentInsets = .init(top: 10,
leading: 10,
bottom: 10,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ final class WebViewController: BaseViewController {

navigationBar.do {
$0.configureBottomLine()
$0.configureCenterTitle(to: navigationTitle, with: .title2!)
$0.configureCenterTitle(to: navigationTitle, with: .title2)
$0.configureBackButtonAction(popViewControllerAction())
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ final class LogInViewController: BaseViewController {
titleLabel.do {
$0.numberOfLines = 0
$0.basic(text: I18N.LogIn.title,
font: .title1!,
font: .title1,
color: .gbbGray700)
}

Expand All @@ -120,7 +120,7 @@ final class LogInViewController: BaseViewController {
signInButton.do {
$0.setTitle(I18N.LogIn.signIn, for: .normal)
$0.setTitleColor(.gbbGray500, for: .normal)
$0.titleLabel?.font = .bodyB2!
$0.titleLabel?.font = .bodyB2
$0.setUnderline()
$0.addAction(UIAction { [weak self] _ in
guard let self else { return }
Expand All @@ -131,7 +131,7 @@ final class LogInViewController: BaseViewController {

accountLabel.do {
$0.basic(text: I18N.LogIn.noAccount,
font: .subHead!,
font: .subHead,
color: .init(hex: "#BDBFC1"))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ final class NickNameViewController: BaseViewController {
titleLabel.do {
$0.numberOfLines = 0
$0.basic(text: I18N.Nickname.title,
font: .title1!,
font: .title1,
color: .gbbGray700)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ final class SignInViewController: BaseViewController {
titleLabel.do {
$0.numberOfLines = 0
$0.basic(text: I18N.SignIn.title,
font: .title1!,
font: .title1,
color: .gbbGray700)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ final class InfoCollectionViewCell: UICollectionViewCell {
}

addressLabel.do {
$0.basic(font: .subHead!, color: .gbbGray400)
$0.basic(font: .subHead, color: .gbbGray400)
$0.adjustsFontSizeToFitWidth = true
}

Expand All @@ -167,11 +167,11 @@ final class InfoCollectionViewCell: UICollectionViewCell {
}

closedDaysLabel.do {
$0.basic(font: .subHead!, color: .gbbError)
$0.basic(font: .subHead, color: .gbbError)
}

openingHoursLabel.do {
$0.basic(font: .subHead!, color: .gbbGray400)
$0.basic(font: .subHead, color: .gbbGray400)
$0.adjustsFontSizeToFitWidth = true
}

Expand All @@ -180,7 +180,7 @@ final class InfoCollectionViewCell: UICollectionViewCell {
}

phoneNumberLabel.do {
$0.basic(font: .subHead!, color: .gbbGray400)
$0.basic(font: .subHead, color: .gbbGray400)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ final class MenuCollectionViewCell: UICollectionViewCell {
}

bakeryMenuLabel.do {
$0.basic(font: .subHead!, color: .gbbGray500)
$0.basic(font: .subHead, color: .gbbGray500)
}

menuPriceLabel.do {
$0.basic(font: .subHead!, color: .gbbGray400)
$0.basic(font: .subHead, color: .gbbGray400)
$0.textAlignment = .right
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ final class TitleCollectionViewCell: UICollectionViewCell {
}

bakeryNameLabel.do {
$0.basic(font: .title1!, color: .gbbGray700)
$0.basic(font: .title1, color: .gbbGray700)
$0.adjustsFontSizeToFitWidth = true
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,11 @@ final class WrittenReviewsCollectionViewCell: UICollectionViewCell {
}

userNicknameLabel.do {
$0.basic(font: .bodyB2!, color: .gbbMain1)
$0.basic(font: .bodyB2, color: .gbbMain1)
}

reviewDateLabel.do {
$0.basic(font: .captionM1!, color: .gbbGray400)
$0.basic(font: .captionM1, color: .gbbGray400)
$0.textAlignment = .right
}

Expand All @@ -139,7 +139,7 @@ final class WrittenReviewsCollectionViewCell: UICollectionViewCell {
}

reviewTextLabel.do {
$0.basic(font: .subHead!, color: .gbbGray400)
$0.basic(font: .subHead, color: .gbbGray400)
$0.numberOfLines = 0
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ final class BakeryDetailCollectionViewFooter: UICollectionReusableView {

label.do {
$0.setLineHeight(by: 1.35)
$0.basic(text: I18N.Detail.menuNotice, font: .captionM2!, color: .gbbGray400)
$0.basic(text: I18N.Detail.menuNotice, font: .captionM2, color: .gbbGray400)
$0.adjustsFontSizeToFitWidth = true
$0.numberOfLines = 2
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ final class BakeryDetailCollectionViewHeader: UICollectionReusableView {
}

titleLabel.do {
$0.basic(font: .bodyB1!, color: .gbbBlack)
$0.basic(font: .bodyB1, color: .gbbBlack)
$0.frame.size = $0.sizeThatFits(self.frame.size)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ final class ReviewProgressView: UIView {
}

reviewLabel.do {
$0.basic(font: .captionB1!, color: .gbbMain2)
$0.basic(font: .captionB1, color: .gbbMain2)
$0.textAlignment = .center
$0.numberOfLines = 1
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ final class BakeryDetailViewController: BaseViewController {
}

tempLabel.do {
$0.basic(font: .subHead!, color: .gbbGray400)
$0.basic(font: .subHead, color: .gbbGray400)
$0.numberOfLines = 0
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ final class DetailReasonTextView: UIView {
}

textLimitLabel.do {
$0.basic(text: "0/140자", font: .captionM1!, color: .gbbGray300)
$0.basic(text: "0/140자", font: .captionM1, color: .gbbGray300)
$0.textAlignment = .right
}
}
Expand Down
Loading

0 comments on commit 91fe37b

Please sign in to comment.