Tampons

I just started using tampons, and I have a couple questions; 1 how do you prevent leaks when swimming and 2 can you wear them at night?