I am using Eureka for my iOS forms. I've got several Datetime rows are initially blank, but once the user taps on the field, the current Date() is filled into the field automatically. See image at the bottom of this post.
The problem here is i need a good way for the user to clear the time, and for the field to revert back to nil after the user has already entered a date.
I was thinking a "clear" button in the keyboard accessory view, but i cant figure out a way to do it with eureka.
Any other implementation suggestions welcomed too!
Here's the code i have for the DateTimeRow
<<< DateTimeRow("Tag Name"){ row in
row.disabled = Condition(booleanLiteral: self.dataEdit?.isLocked ?? false)
} .cellSetup { (cell, row) in
row.title = "Duty Start Time"
row.value = self.dataEdit == nil ? nil : self.dataEdit?.dutyStart
row.dateFormatter?.timeZone = TimeZone(secondsFromGMT: 0)
cell.datePicker.timeZone = TimeZone(secondsFromGMT: 0)
} .onChange{ row in
//currently empty
} .onCellHighlightChanged({ (cell, row) in
// this used to fill in the current date once the user taps on an empty field
if row.value == nil {
row.value = Date()
}
})

you can modify accessoryview. first add that class.
in your controller override is such as
it will add a clear button. there will be warning for you "No method declared with Objective-C selector 'clearAction:'.
make a selector to clear your input.
when clicked the function get your input such as
update:::
try to change your func like that.
if this not works try second option for making a global tagNo variable to get which row has been selected.