Skip to content

Row with SwitchAccessory loses its state after scrolling the table #135

@n3d1117

Description

@n3d1117

Hello!

I am using a Row with UISwitch as seen in the example project here.
However when scrolling down the table and then up again, the switch loses its on state.

Tested straight from example project:

Is this due to cell reusing? How can I preserve switch state on scroll?

Thanks

EDIT: This is the way I'm using it. Am I doing something wrong?

var value: Bool = false

Row(text: "UISwitch", accessory: .switchToggle(value: self.value) { [unowned self] newValue in
     self.value = newValue
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions