- August 12, 2025
- Mins Read
GenericPasswordRow
is a custom row for Eureka designed to create passwords. Its main purpose is to guide users through this process according to a set of validations.
import Eureka
import GenericPasswordRow
class ViewController: FormViewController {
override func viewDidLoad() {
super.viewDidLoad()
form +++ Section()
<<< GenericPasswordRow()
}
}
Before contribute check the CONTRIBUTING file for more info.
If you use GenericPasswordRow in your app we would love to hear about it! Drop us a line on twitter.
Follow these steps to run Example project:
CocoaPods is a dependency manager for Cocoa projects.
To install GenericPasswordRow, simply add the following line to your Podfile:
pod ‘GenericPasswordRow’, ‘~> 3.1’
Carthage is a simple, decentralized dependency manager for Cocoa.
To install GenericPasswordRow, simply add the following line to your Cartfile:
github “EurekaCommunity/GenericPasswordRow” ~> 3.1
For basic styling like fonts, colors, margins, separators you should use cellSetup
and cellUpdate
. Otherwise, you should be able to provide a completely different design (different nib file) and reuse the already implemented logic.
var passwordValidator: PasswordValidator = DefaultPasswordValidator()
: a PasswordValidator intended to define the rules to be satisfied by the password. See Implement custom validationvar placeholder: String? = "Password"
: placeholder of password textfield.For example you can do this:
<<< GenericPasswordRow() {
$0.passwordValidator = // instantiate your custom validator
$0.placeholder = “Create a password”
}
@IBOutlet weak var textField: UITextField!
:@IBOutlet weak var visibilityButton: UIButton?
:secureTextEntry
property of textField
.@IBOutlet weak var passwordStrengthView: PasswordStrengthView?
:PasswordStrengthView
with the custom design of the strength indicator. See PasswordStrengthView@IBOutlet weak var hintLabel: UILabel?
:var visibilityImage: (on: UIImage?, off: UIImage?)
:secureTextEntry
state.var dynamicHeight = (collapsed: UITableViewAutomaticDimension, expanded: UITableViewAutomaticDimension)
:You might want to follow your own design. To accomplish this you should follow these steps:
Create a user interface xib file and edit it with Xcode’s Interface Builder. You should add a simple UITableViewCell
and say that its class is a GenericPasswordCell
.
Add an UITextField for the password entry and connect it to the textField
outlet.
[optional] Add an UIButton and connect it to the visibilityButton
.
[optional] Add a PasswordStrengthView subclass and connect it to the passwordStrengthView
outlet.
[optional] Add an UILabel and connect it to the hintLabel
outlet.
Specify that you want to use the newly created nib file. You can do this in two ways:
GenericPasswordRow.defaultRowInitializer = {
$0.cellProvider = CellProvider<GenericPasswordCell>(nibName: “MyPasswordCell”, bundle: nil)
}
_GenericPasswordRow
:
final class MyPasswordRow: _GenericPasswordRow, RowType {
required init(tag: String?) {
super.init(tag: tag)
cellProvider = CellProvider<GenericPasswordCell>(nibName: “MyPasswordCell”, bundle: nil)
}
}
If you are providing a custom nib file, you can also provide a custom subclass of PasswordStrengthView
different from the DefaultPasswordStrengthView. You just need to implement the following methods:
class PasswordStrengthView: UIView {
public func setPasswordValidator(validator: PasswordValidator) { }
public func updateStrength(password password: String, animated: Bool = true) { }
}
In order to provide a custom password validation you need to provide a conformance to the PasswordValidator
protocol at the passwordValidator
property of the GenericPasswordRow
instance.
protocol PasswordValidator {
protocol PasswordValidator {
var maxStrength: Double { get }
func strengthForPassword(password: String) -> Double
func hintForPassword(password: String) -> String?
func isPasswordValid(password: String) -> Bool
func colorsForStrengths() -> [Double: UIColor]
}
This validator should define the strength of any given password between zero and maxStrength
values. Also, the func colorsForStrengths() -> [Double: UIColor]
function should return a dictionary specifying key points of strength values and the associated color starting from there. See DefaultPasswordValidator.
Recognize your user's voice elegantly without having to figure out authorization and audio engines. SwiftSpeech Examples Features Installation Getting Started ...
Example To run the example project, clone the repo, and run pod install from the Example directory first. Requirements iOS 14.0 Installation ...
SlidingRuler is a Swift package containing a SwiftUI control that acts like an linear infinite slider or a finite, more precise ...
SkeletonUI aims to bring an elegant, declarative syntax to skeleton loading animations. Get rid of loading screens or spinners and ...