Closed scottmesser closed 5 years ago
not exactly a dupe, I would like to pass in a row type not modify it post creation.
this seems to work for now,
func addSplitRow<row: RowType>(rowType: row,) where row: BaseRow {
form +++ SplitRow<row, row>() {
switch rowType {
case is TextFloatLabelRow:
$0.rowLeft = //add row
default:
//default case
}
}
}
@SMesser55 glad you found a solution!
I'm aware that typing the type twice (once in the row definition and once for child-row-initialization) is a bit tedious, but both serve a different purpose. I can't think of a clever solution to make this easier and still support each builtin and possible future custom row.
However, If you find such a clever solution I'm happy to merge a pull request!
Anyway to make adding a split row more generic?
For example...
form +++ SplitRow<TextFloatLabelRow, TextFloatLabelRow>() {...}
this requires that TextFloatLabelRow be explicitly stated. I would like to do something like...
form +++ SplitRow<rowA, rowB>() {...}
this would allow rowA to be TextRow,EmailRow, Phone row, etc. Any ideas? Thanks!