Well, you won't be using your food for energy during a training session, or at least it's unlikely. You'll be burning down glycogen and fat, and a little bit of circulating blood glucose.
To increase the circulating blood glucose it's generally better to favor liquid over solid. And depending on how long you wait before swimming, the ideal content of the pre-swim meal may vary a lot. The member that posted a light meal answer probably swims am, or uses his suggestion as a small (thus easy to digest) meal, which could increase the blood glucose a bit, therefore the likelihood of being able to use it. If you eat 3 hours before then that's a completely different story. And there your pastas etc are very suitable, as they will release some glucose at a much slower rate.
Ideal meal post swim, well first it's better to state on the ideal time to take that meal, and that would be within 30min after the swim, ideally within 15min. This is when the rate of glycogen replenishment is at its peak. You can go around 300 cal usually, a lot rely on chocolate milk, which is a sound choice anyway. It doesn't have to be complex.
Then what you eat after this important recovery meal is governed by the rules of nutrition in general, and aiming for balanced approach generally works best. If you don't eat red meat or very little, make sure you get your iron one way or another (just don't eat nails

)
If you're an elite or aim at being one, then yearly blood test to see if you're not under minimal all across the board isn't a bad thing. Anemia sucks, especially when you don't know you suffer from it.