Oya Canli
12/05/2019, 1:26 PMmyBoolean ^= true
So if it was true, it becomes false and if it was false it becomes true. Is there an equivalent in kotlin?karelpeeters
12/05/2019, 1:26 PMmyBoolean = !myBoolean
diesieben07
12/05/2019, 1:27 PMdiesieben07
12/05/2019, 1:27 PMtrue
is clever, but you shouldn't have to look at something as simple as flipping a boolean and have to think about it for a minute.Oya Canli
12/05/2019, 1:47 PMviewModel.isChildFragVisible = !viewModel.isChildFragVisible
and I type this in six places, so I thought there might be a better way.
But you're right, xor is not very expressive of the intent. May be I can just write a simple extension function called flip() or flipTruth()karelpeeters
12/05/2019, 1:49 PMviewModel.toggleVisibility()
could work of course.Oya Canli
12/05/2019, 2:01 PMmarioled
12/05/2019, 8:01 PM