In Australia you can easily get stretchy (so they're close-fitting) UV-resistant T-shirts, known as rashi tops. It doesn't feel as nice as swimming unclothed, but they're worn for sun protection, especially by children. They're not cheap (but the fabric has to be UV and chlorine resistant), and they seem to be rarer elsewhere, but you sometimes see them worn by surfers etc.