add custom fonts to SwiftUI

pull/874/head
Ryan Zhao 11 months ago
parent 1a22bd07ef
commit 09bece5c10

@ -241,12 +241,14 @@ struct MessageInfoView: View {
alignment: .leading,
spacing: 4
) {
Text(messageViewModel.senderName ?? "Tester")
.bold()
.font(.system(size: 18))
.foregroundColor(themeColor: .textPrimary)
if !messageViewModel.authorName.isEmpty {
Text(messageViewModel.authorName)
.bold()
.font(.system(size: 18))
.foregroundColor(themeColor: .textPrimary)
}
Text(messageViewModel.authorId)
.font(.system(size: 16))
.font(.spaceMono(size: 16))
.foregroundColor(themeColor: .textPrimary)
}
}

@ -1,4 +1,5 @@
import UIKit
import SwiftUI
@objc(LKFonts)
public final class Fonts : NSObject {
@ -11,3 +12,13 @@ public final class Fonts : NSObject {
return UIFont(name: "SpaceMono-Bold", size: size)!
}
}
public extension Font {
static func spaceMono(size: CGFloat) -> Font {
return Font.custom("SpaceMono-Regular", size: size)
}
static func boldSpaceMono(size: CGFloat) -> Font {
return Font.custom("SpaceMono-Bold", size: size)
}
}

Loading…
Cancel
Save