TFontManager 1.0.0

TFontManager 1.0.0

the-best-is-best 管理。



  • Michelle Raouf

TFontManager

Version License Platform

示例

 import TFontManager

class AppDelegate: NSObject, UIApplicationDelegate , UNUserNotificationCenterDelegate {
   func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
       
       TFontManager.shared.setFontMappings([
           fontsFamiliy[0] : [
               .regular: SharedRes.fonts().montserrat_regular.fontName,
               .medium: SharedRes.fonts().montserrat_medium.fontName,
               .bold: SharedRes.fonts().montserrat_bold.fontName
               
           ],
           fontsFamiliy[1]: [
               .medium: SharedRes.fonts().inter_medium.fontName
           ],
           fontsFamiliy[2]: [
               .regular: SharedRes.fonts().tiny5_regular.fontName
           ]
           
       ])
       ```
                 
        return true
       
   }
}

let fontsFamiliy: [String] = [
   "montserrat",
   "inter",
   "tiny5"
]
 struct ContentView: View {
 
   var body: some View {
    
       if let regularFont = TFontManager.shared.customFont(family: fontsFamiliy[2], size: 16, weight: .regular) {
           
           Text("greet").font(regularFont)
       }
   }
}

struct ContentView_Previews: PreviewProvider {
   static var previews: some View {
       ContentView()
   }
}

要求

安装

TFontManager 通过 CocoaPods 可用。安装它,只需将以下行添加到 Podfile

pod 'TFontManager'

作者

Michelle Raouf, [email protected]

许可

TFontManager 按MIT许可证可用。有关更多信息,请参阅 LICENSE 文件。