All Projects → higepon → Swift Uikit Extensions

higepon / Swift Uikit Extensions

Extensions for UIKit in Swift

Programming Languages

swift
15916 projects

What is this?

Useful extensions for UIKit in Swift as follows.

// Create UIColor instance by hex integer value
let darkOrange = UIColor(hex:0xFF8C00)

How to use

Copy *.swift to your project.

Examples

// UIControl
let button = UIButton.buttonWithType(UIButtonType.Custom) as UIButton!
button.enable()
button.disable()

// UIColor
let darkOrange = UIColor(hex:0xFF8C00)

// Web Colors
UIColor().PinkWebColor()

// UIView
let title = UILabel(frame: CGRect(x: 50, y: 80, width: 200, height: 50))
title.text = "Hello, World"
title.sizeToFit()
title.centerHorizontally(320)

// UITableView
self.tableView.scrollToBottom()

// UIConstants
let width = UIConstants.screenWidth()
let height = UIConstants.screenHeight()

UIControl

Method Description
func enable() Enable UIControl (.enabled = true)
func disable() Disable UIControl (.enabled = false)

UIColor

Method Description
init(hex: Int) let darkOrange = UIColor(hex:0xFF8C00)

UIView

Method Description
func centerHorizontally(parentWidth: Double) Centering UIView holizontally. See Examples below.

UITableView

Method Description
func scrollToBottom(animated: Bool = true) tableView.scrollToBottom()

UIConstants

Method Description
func screenWidth() UIConstants.screenWidth()
func screenHeight() UIConstants.screenHeight()

License

The MIT License (MIT)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].