One of the best things to do to protect your hair from salt water is to wear it up in a bun if possible. This is because salt water can strip moisture from the hair and make it really, really, dry leading to split ends, breakage, and dull, lackluster hair. If you have your hair in a bun, it means less hair is actually exposed to the salt water.
Before putting it into the bun, is to wet your hair and apply a pre-shampoo such as the one designed to protect your hair from the ocean or chlorine. One pre-shampoo that comes highly recommended is Swimcap which was designed to protect hair from both the salt water and UV rays. If you can't find a good pre-shampoo, cover your hair in an oil like coconut or jojoba to keep it from absorbing as much salt water.
Once you are done swimming, rinse your hair with fresh water but sometimes that can be difficult so bring an extra bottle of water so you can do this. I sometimes carry a cup along so I can fill it from the sink and pour it over my hair to get rid of all the salt or I've used it if the water coming from the shower head was not spraying properly.
Then wash it as soon as you possibly do it. As soon as I got back to my hotel room, I washed my hair to get rid of any remaining salt that I didn't get when I rinsed my hair after swimming. Select a shampoo and conditioner that are designed to add moisture to your hair while helping restore elasticity. In addition, if you are swimming a lot, use a hydrating hair mask at least twice a week to keep it healthier. Don't be afraid to use a leave-in conditioner to add extra hydration to your hair. If you don't use enough conditioner, it can be quite difficult to comb your hair properly which can lead to additional damage.
Furthermore, skip the blow dryers and hot tools because the salt water dries your hair out and these can make them even dryer. If you don't use them, you are giving your hair a chance to repair themselves. Just let your hair air dry for the best results.
One final thing to think about is to apply a UVA/UVB spray to your hair or apply a sunscreen designed for your hair on before going out. This will protect your scalp from burning and it will help protect your hair from sun damage. I know that this type of product is hard to find where I live but I know it can be ordered off of Amazon quite easily and they offer a variety of products.
Think about all of these things when you go swimming in the ocean. Let me know what you think, I'd love to hear. Have a great day.