This is permissible provided that the shorts are long enough that they cover your awrah; which is the area between the navel and the knees. And that the swimming area is segregated.
This is permissible provided that the shorts are long enough that they cover your awrah; which is the area between the navel and the knees. And that the swimming area is segregated.