While you can wear a sun hat while swimming, certain types of hats are more suitable for water activities. Look for sun hats that are made of quick-drying materials and have a chin strap to keep them secure while swimming. Additionally, opt for hats with UPF (Ultraviolet Protection Factor) for maximum sun protection. Remember to rinse your hat with fresh water after swimming in saltwater to maintain its durability and condition.