Need help with swift button and TinyDB

Hi guys, tell me, is it possible to make tinydb keep the position of the swift switch button? An example of my test in the screenshot.

Thank you in advance!

Yes. Save the state of the switch (true or false) in a tag named accordingly.
Then when you need to restore the switch from the tinydb, you only need to read what’s in that tag and set it.

could you give an example in blocks?

You save the current state of the switch like this:
image

And restore the switch from what you saved like this:
image

5 Likes

thanks for the decision, I’ll check tomorrow, I’ll give feedback after the test

1 Like