Skip to content

josharnoldjosh/IconTextField

Repository files navigation

IconTextField

CI Status Version License Platform

Its as easy as:

textfield.setIcon(UIImage(named: 'PasswordLock'))

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

IconTextField requires SnapKit.

Installation

IconTextField is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'IconTextField2'

Example

IconTextField works just like UITextField, except with currently two extra methods, setIcon and underline.

Example:

import IconTextField2

// ...

let passwordTextField = IconTextField(frame: CGRect(x: 0, y: 0, width: 100, height: 50))

// Set the icon
passwordTextField.setIcon(image: UIImage.init(named: "Lock"))

// Add a nice underline
passwordTextField.underline()

Methods:

func setIcon(image:UIImage?, width:CGFloat = 25, padding:CGFloat = 10)
func underline(color:UIColor = UIColor.init(white: 0.85, alpha: 1))
  • Width essentially specifies the size of your image, the bigger the width the bigger your image.
  • Padding controls the space between your image and the where you type your text

Author

josharnoldjosh, [email protected]

License

IconTextField is available under the MIT license. See the LICENSE file for more info.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published