What's New

CCNextField

2022-05-03T21:33:45Z

Full Changelog: 0.1.0...0.1.1

CCNextField

Version License Platform

Conceit NextField is an an extension to UIKIT's UITextField with an easy usage to handle switching to the next UITextField when tapping the return key.

textField.nextField(resigns: true) {
  print("noice")
}

Example

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

Installation

CocoaPods

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

pod 'CCNextField'

Direct

Copy the CCNextField file from Source folder.

Usage

// Conform your UIViewController/UITableViewConroller to UITextFieldDelegate
class ViewController: UIViewController, UITextFieldDelegate {
    
    // Connect textFields from storyboard
    @IBOutlet weak var nameTextField: UITextField!
    @IBOutlet weak var emailTextField: UITextField!
    @IBOutlet weak var passwordTextField: UITextField!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        // Add all your textFields
        let textFields = [nameTextField,
                          emailTextField,
                          passwordTextField]
        
        // Connect textFields to delegate & set textField.tag
        for field in textFields {
            field!.delegate = self
            field!.tag = textFields.firstIndex(of: field)!
        }
    }
  
	  // Get current textField and call nextField.
    func textFieldShouldReturn(_ textField: UITextField) -> Bool {
        // Set (resigns) to true to hide keyboard, or false to just execute your function.
        textField.nextField(resigns: true) {
            print("noice")
        }
        return false
    }
}

2022 Conceit LLC

License

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

Description

  • Swift Tools
View More Packages from this Author

Dependencies

  • None
Last updated: Tue Jan 16 2024 08:45:48 GMT-1000 (Hawaii-Aleutian Standard Time)