Is there a way to set a custom width for SegmentedRows? If not, is it possible to add the ability in a future release?
I did this with an extension for now:
extension SegmentedCell {
func setControlWidth(_ width: CGFloat) {
guard let segmentedControl = segmentedControl else { return }
let constraint = NSLayoutConstraint(
item: segmentedControl,
attribute: .width,
relatedBy: .equal,
toItem: nil,
attribute: .notAnAttribute,
multiplier: 1,
constant: width
)
addConstraint(constraint)
}
}
SegmentedRow<String> {
$0.title = "Choose"
$0.options = ["A", "B", "C"]
}.cellUpdate { cell, _ in
cell.setControlWidth(300)
}
@samrayner It's a good solution.
Alternatively you can extend SegmentedRow and its cell and update its constraints. Anyway your solution seems more elegant and easier.
Most helpful comment
I did this with an extension for now: