Transpile `Bool.toggle()`
https://developer.apple.com/documentation/swift/bool/toggle()
It's quite handy, and every time it comes up in my transpiled Swift project, I stub my toe and replace enabled.toggle() with enabled = !enabled.
This seems like it should be pretty straightforward to transpile.
This would certainly be nice to have. The limitation is that we cannot extend pre-existing types (i.e., Bool) with a mutating function, because the way we handle mutating is to have the type implement our own value type handling code. It is the same reason we cannot implement String.append.
In theory we could identify these common mutating functions on a case-by-case basis and provide implementations at the call site. E.g.,
var b = true
b.toggle()
could be transpiled into the Kotlin:
var b = true
b = !b