Skip to content

LeBzul/Theme

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Theme

Configure Theme and automatic apply for UITextView / UILabel / UIButton ...

Installation

Import folder Theme_src.swift in your project (or use example project)

Usage

Initialise library "Theme" in your AppDelegate in didFinishLaunchingWithOptions method :

  func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        UIViewController.swizzleExtension()
        return true
    }

Configure "Theme" for UIView Element (is better in your AppDelegate in didFinishLaunchingWithOptions) :

UITextField
   UITextField.initTheme(fontSize: 14, fontName: "HelveticaNeu", textColor: UIColor.brown, backgroundColor: UIColor.lightGray, borderColor: UIColor.black, borderStyle: .bezel)
UILabel
   UILabel.initTheme(fontSize: 18, fontName: "HelveticaNeu", textColor: UIColor.darkText, backgroundColor: UIColor.red)
UIButton
   UIButton.initTheme(fontSize: 28, fontName: "Helvetica", textColor: UIColor.white, backgroundColor: UIColor.darkGray, cornerRadius: 8)
UITextView
   UITextView.initTheme(fontSize: 16, fontName: "Helvetica", textColor: UIColor.white, backgroundColor: UIColor.darkGray)

By default, Theme is no activated, in IB, select view and switch "withTheme" to "On" :

Img

Or in code (in viewDidLoad) :

   let label = UILabel(frame: CGRect(x: 0, y: 0, width: 120, height: 35))
   label.withTheme = true

About

Configure and automatic apply Theme for UITextView / UILabel / UIButton ....

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages