Bibi's DevLog ๐ค๐
UIFont Extension - custom font ๋ณธ๋ฌธ
๋จผ์ ์ํ๋ ํฐํธ ํ์ผ์ ๋ค์ด๋ก๋๋ฐ๊ณ , ํ๋ก์ ํธ์ ํฌํจ์ํค๊ณ , Info.plist์ ๋ฑ๋กํด ์ฃผ์ด์ผ ํ๋ค. ์ ๋งํฌ๋ฅผ ์ฐธ๊ณ ํ๋ค.
์ดํ ํฐํธ ํ์ผ์ ์ด๋ฆ(ํ์ฅ์ ์ ์ธ)์ UIFont(name:)์ผ๋ก ์ง์ ํ๋ค.
import UIKit
enum CustomFont {
case santanaBlack
}
extension UIFont {
static func customFont(_ name: CustomFont) -> UIFont {
switch name {
case .santanaBlack: // set font and size you want
return UIFont(name: "Santana-Black", size: 32) ?? UIFont()
}
}
}
'๐ฑ๐ iOS > Code Templates' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[Swift] Linked List - Singly Linked List ๊ตฌํ (0) | 2022.12.15 |
---|---|
[Swift] URL์์ ๋น๋๊ธฐ๋ก ์ด๋ฏธ์ง ๋ค์ด๋ก๋ ๋ฐ ์บ์ฑํ๊ธฐ - NSCache (0) | 2022.05.18 |
์ฝ๋๋ก UIView ๋ง๋ค๊ธฐ ๊ธฐ๋ณธ ํ ํ๋ฆฟ (0) | 2022.05.11 |
UIColor extension (0) | 2022.05.11 |
[Swift] JSON API์ ๋คํธ์ํฌ ํต์ ํ๊ธฐ - URLSession, JSONConverter (0) | 2022.04.29 |