By default mistica uses the system font, but it can be overriden with the Telefónica ones:
- Download the fonts from the links above. OTF or TTF fonts are preferred, and we only need three weights: light, regular and medium.
- Add all three font files to your app Resources and make sure that they are added to your app target.
- Include them in your app plist under the key
Fonts provided by application
. Inside you need to specify all three font files, for example:Telefonica-Light.otf
,Telefonica-Regular.otf
andTelefonica-Medium.otf
. - Configure the Mistica framework to use this font. In your app delegate or in other place before any view is created, set up the
fontNameForWeight
property for SwiftUI code andUIfontNameForWeight property
for UIKit:
// For SwiftUI
FontStyle.fontNameForWeight = { weight in
switch weight {
case .light, .ultraLight, .thin:
return "Telefonica-Light"
case .regular:
return "Telefonica-Regular"
case .medium, .bold, .semibold, .black, .heavy:
return "Telefonica-Bold"
default:
return "Telefonica-Regular"
}
}
// For UIKit
FontStyle.UIfontNameForWeight = { weight in
switch weight {
case .light, .ultraLight, .thin:
return "Telefonica-Light"
case .regular:
return "Telefonica-Regular"
case .medium, .bold, .semibold, .black, .heavy:
return "Telefonica-Bold"
default:
return "Telefonica-Regular"
}
}
If you have further issues, this checklist is a pretty good way of fixing them.