The ocean temperature in Cape Town is quite cold, but it depends on the beach you are visiting.
Generally beaches on the West Coast, such as Bloubergstrand, Sea Point, Clifton, Camps Bay and Llundadno, tend to have very low temperatures (12-15 degrees) in summer and winter, except on days when an unpredictable warm current raises the temperature.
On the beaches on the east coast, False Bay, like Muizenberg, Fish Hoek, Boulders, the water temperature rises up to 16 degrees in winter and 20 degrees in summer.
To find warmer waters you should move eastward along the Garden Route, or even go up to Durban, where temperatures are similar to those of the Mediterranean.
There are wonderful wild beaches, but before you swim it is better to inquire if there are dangerous currents.
If you practice sea sports like surfing or canoeing, you should know that Great white sharks are present in False Bay and in the Indian Ocean. Fatal attacks are very rare. However the more exposed beaches, like Muizenberg, have a flag system to indicate the presence of sharks in the bay. Shark nets are only found in KwaZulu-Natal, on the east coast of South Africa. Along the Atlantic coast you don’t have to worry and can swim peacefully at beaches around the centre of the city (e.g. Camps Bay, Clifton, Sea Point, Milnerton, Bloubergstrand).