As with any exercise, as much as you feel is physically possible. However test before, during (if possible) and afterwards and record your results, as this is a useful way to see what your body is conditioned to do without running high/low. I swim each week and find I dip about an hour afterwards so as long as i have a snack afterwards i'm fine. Just be aware some swimming pools are fairly cool so you can burn extra glucose keeping warm and try to keep your testing kit + glucose nearby or with the lifeguard.
Run sweet is a good site to follow if you exercise as they offer tips on various sports:
http://www.runsweet.com/Swimming.html