This was tested on windows 10 and xbox https://www.youtube.com/watch?v=udKGVj9MyKg&feature=youtu.be Conditions: These have changed all you need is to be in swim mode, touching a ceiling above the water, and staying on the same y as you swim out of the water with blocks still above you. Under other conditions you may need to be looking up to an extent.
Also special thanks to error404.exe on discord for helping me confirm the bug
Edit: Double toad made a great video showing off other things this bug can do https://youtu.be/aIH1Ab_5VZI
Edit 2:i noticed in Silent wisperers video (6:28) https://www.youtube.com/watch?v=zQhrPKIcjz8 He can look in different directions. Seems like depending on how you do the bug affects how it works a little