Always wear a mask, fin and snorkel and preferably a wetsuit when swimming with sharks. Obviously, the mask lets you see any sharks, while fins and snorkel will allow you to swim relatively calmly and efficiently.
Never free-dive or snorkel with marine mammals where there is the possibility encountering sharks, as the sharks may mistake you for their natural prey. If sharks do appear, do not thrash about but instead swim calmly and leave the water.
Avoid swimming with sharks at dusk or dawn, many sharks are crepuscular in their feeding patterns, meaning they feed at dawn and dusk unless other opportunities arrive. I have on occasion been harassed by grey reef sharks at dusk which during the day had been timid and kept their distance.
We seek out opportunities to swim with sharks. They are a beautiful but threatened group of species. Instead of fearing sharks, divers should cherish swimming in the presence of these amazing and increasingly rare animals.
Each year, up to 100 million sharks are killed for their fins, jaws, teeth, meat, or by accident. On average, for every human killed by sharks up to 20 million sharks are killed by people. Divers and people, in general, should stop fearing sharks and start protecting them.