There are some opinions that say that swimming when fasting is strongly recommended if it can increase the spirit in running the fast.
Because in Islam, anything that can increase the spirit to obey God is highly recommended. It can also ease the burden of worship on a person.