When customizing text row using Eureka on iOS, I encounter some weird problems. So I write this post to share some tips.
Connect IBOutlet
Normally we custom UI of a row by loading xib like this:
<<< PostalAddressRow() {
$0.cellProvider = CellProvider<PostalAddressCell>(nibName: "CustomNib", bundle: Bundle.main)
}
If you’re dealing with TextRow, the cell in xib must be subclass of TextCell. But when doing so something strange happen: the IBOutlet of textField and titleLabel does not show in the connections inspector, despite in the code of Eureka has declarations for these 2 properties.
It turns out in an issue on Eureka’s Github page that we have to subclass the cell to _FieldCell for Xcode to show IBOutlet s.

After connecting the IBOutlet you can change cell’s subclass back to TextCell or any class you want. In the connections inspector of interface builder will show yellow marks but it’s ok, you can still the the code without any problem.

Override Eureka’s default settings
If you ever change some config in the xib for UITextField like text color, font size, … then run Xcode, you’ll the text field still shows default values, not your customization. The reason for this is Eureka always reset attributes of text field to default each time method update() of _FieldCell is called. Therefore to fix we need to override method update() to overwrite these properties such as:
class CustomTextCell: TextCell {
override func update() {
super.update()
textField.textColor = UIColor.white
textField.font = UIFont.systemFont(ofSize: 14)
}
}
Wraps Up
That’s all the tips you need to know when dealing with TextRow using Eureka. Hope this article is helpful to you.