Interesting. The issue seems to be that some layouts simply input the tilde but others use it as a dead character which requires another character to combine it with (which allows you to write letters like ñ). It seems to be specific to tilde, though, as the Czech layout uses a couple of dead characters (ˇ,´ and ¨) and there are no issues with those in Defold.
Pseudoedit: I’ve installed German (Swiss) layout on my computer and tilde is inserted as described in the OP (though I use AltGr as I’m on Windows). It works perfectly on the forums, though in Defold it inputs ~^ for some reason (^ is the dead character that is the result of that key without using AltGr). This makes it impossible to use the key to write ñ (as it tries to combine the tilde with the ^, resulting in ~^n) but tilde itself isn’t a problem, though it’s a bit unwieldy.
I wonder if this is because the OP uses a different Swiss layout (French(Swiss) maybe?), or that the issue manifests in a different way on Linux.