Having shower, bath or swimming in the sea does not break fasting. But, if any water runs through the nose or mouth, that breaks the fast. Watching this out is possible while having shower or bath. However, water running through nose or mouth is frequently possible while swimming. Therefore, you should avoid swimming while fasting.