Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SegmentedCell: cast row to OptionsRow not to the SegmentedRow #2183

Conversation

maxisa2017
Copy link
Contributor

SegmentedCell can only be used with SegmentedRow. It force-casts the row value to SegmentedRow when it reads an options variable. Actually this var is a part of OptionsProviderRow protocol.
Changing the casting type to OptionsRow allows us to keep the same behaviour for existing classes and extends the reuse of SegmentedCell.
We cannot modify SegmentedRow class, because it is marked as final, but we will be able to use this cell in custom classes:

// MARK: AdvancedSegmentedRow
public final class AdvancedSegmentedRow<T: Equatable>: OptionsRow<SegmentedCell<T>>, RowType {
  required public init(tag: String?) {
    super.init(tag: tag)
  }

public override func updateCell() {
    super.updateCell()
    cell.applyDisabledAppearance()
  }
} 

@mats-claassen mats-claassen merged commit 1176065 into xmartlabs:master Oct 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants