I really enjoy swimming in the ocean
Swimming is among the top public recreational activities.  I hope you swim where there is a lifeguard!
I try too, one time I saw a shark while swimming
Be careful.  Although lifeguards are rescuers, they can't protect you from sharks.
what is the best protection from sharks?
Probably the removal of sharks by fishing and seperation of people from sharks, like by nets.
aren't nets dangerous for other wildlife though?
Shark nets mesh size is usually large enough to avoid disruption to most sea life.
that's good, I feel it is important to protect wildlife
Shark net
A shark net is a submerged net placed around beaches to reduce shark attacks on swimmers. The majority of Shark nets used are Gillnets which is a wall of netting that hangs in the water and captures the targeted sharks by entanglement. The nets in Queensland, Australia, are typically 186m long, set at a depth of 6 m, have a mesh size of 500 mm and are designed to catch sharks longer than 2m in length. Shark nets are not to be confused with shark barriers.
Lifeguard tower
Lifeguard towers are used at recreational beaches or public swimming pools to watch and supervise swimmers in order to prevent drownings and other dangers. Lifeguards scan for trouble from the structures, which vary from beach bungalows by the ocean to poolside towers. Lifeguard towers are also used to spot sharks and other threats.
The towers have featured in television shows including "Baywatch". Their construction is sometimes paid for with fundraisers, and their operation and staffing is subject to funding availability. Design contests have challenged architects to offer