-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFont.swift
60 lines (54 loc) · 1.79 KB
/
Font.swift
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//
// Font.swift
// Covid19Tracker
//
// Created by Jonathan Bijos on 30/03/20.
// Copyright © 2020 DevsCarioca. All rights reserved.
//
import UIKit
enum Font {
static func regular(size: CGFloat) -> UIFont {
let fontName = "Nunito-Regular"
guard let font = UIFont(name: fontName, size: size) else {
fatalError("""
Failed to load the "\(fontName)" font.
Make sure the font file is included in the project and the font name is spelled correctly.
"""
)
}
return font
}
static func light(size: CGFloat) -> UIFont {
let fontName = "Nunito-Light"
guard let font = UIFont(name: fontName, size: size) else {
fatalError("""
Failed to load the "\(fontName)" font.
Make sure the font file is included in the project and the font name is spelled correctly.
"""
)
}
return font
}
static func bold(size: CGFloat) -> UIFont {
let fontName = "Nunito-Bold"
guard let font = UIFont(name: fontName, size: size) else {
fatalError("""
Failed to load the "\(fontName)" font.
Make sure the font file is included in the project and the font name is spelled correctly.
"""
)
}
return font
}
static func semiBold(size: CGFloat) -> UIFont {
let fontName = "Nunito-SemiBold"
guard let font = UIFont(name: fontName, size: size) else {
fatalError("""
Failed to load the "\(fontName)" font.
Make sure the font file is included in the project and the font name is spelled correctly.
"""
)
}
return font
}
}