v2.0.2
UIOnboarding 2.0.2 introduces custom font- (#13) and feature list styling (#8, #13) and resolves layout issues (#10).
Discussion
Simply provide the PostScript name of your custom font in the view's configuration. For the title labels pass the UIFont directly as an attribute to the string. UIOnboarding handles correct font sizing, scaling for Dynamic Type and fallback to system default.
Read more on how to add custom fonts to your project.
// UIOnboardingHelper.swift
// Second Title Line
// App Name
static func setUpSecondTitleLine() -> NSMutableAttributedString {
let secondTitle: NSMutableAttributedString = .init(string: Bundle.main.displayName ?? "Insignia")
secondTitle.addAttribute(.foregroundColor,
value: UIColor.init(named: "camou") ?? UIColor.init(red: 0.654, green: 0.618, blue: 0.494, alpha: 1.0),
range: .init(location: 0, length: secondTitle.length))
guard let customFont: UIFont = .init(name: "Akkurat-Bold", size: UIFont.labelFontSize) else {
return secondTitle
}
secondTitle.addAttribute(.font,
value: customFont,
range: .init(location: 0, length: secondTitle.length))
return secondTitle
}
// Continue Button
static func setUpButton() -> UIOnboardingButtonConfiguration {
.init(title: "Continue",
fontName: "Akkurat-bold",
backgroundColor: .init(named: "camou") ?? UIColor.init(red: 0.654, green: 0.618, blue: 0.494, alpha: 1.0))
}
}
Check out the new UIOnboardingFeatureStyle
configuration. For instance, change the font size of the feature labels. UIOnboarding takes care of calculating the respective font sizes for Dynamic Type.
// UIOnboardingViewConfiguration.init()
featureStyle: .init(descriptionFontSize: 15),