-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUIFont.swift
More file actions
36 lines (30 loc) · 932 Bytes
/
UIFont.swift
File metadata and controls
36 lines (30 loc) · 932 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//
// UIFont.swift
// sopt-37th-02Seminar
//
// Created by JIN on 10/26/25.
//
import Foundation
import UIKit
enum FontName: String {
case pretendardBold = "Pretendard-Bold"
case pretendardSemiBold = "Pretendard-SemiBold"
case pretendardLight = "Pretendard-Light"
case pretendardMedium = "Pretendard-Medium"
case pretendardRegular = "Pretendard-Regular"
case pretendardExtraBold = "Pretendard-ExtraBold"
}
extension UIFont {
static func font(_ style: FontName, ofSize size: CGFloat) -> UIFont {
guard let customFont = UIFont(name: style.rawValue, size: size) else {
return UIFont.systemFont(ofSize: size)
}
return customFont
}
@nonobjc class var size17: UIFont {
return UIFont.font(.pretendardSemiBold, ofSize: 17)
}
@nonobjc class var size24: UIFont {
return UIFont.font(.pretendardExtraBold, ofSize: 24)
}
}