I'm sure you'll get lots of different opinions on this, in extreme disagreement with each other, but here's my experience.
If you just swat a hand randomly, in reaction to things your child does and without context, then, yes, perhaps you will "teach him to hit." But, honestly, no one needs to teach a child to hit. They all figure it out on their own, and whether they keep doing it depends upon reinforcement.
If you stop, calmly look the child in the eye, say "no pinching!"- perhaps pointing to the pinched spot for clarity - hold his wrist for control and swat the hand that pinched, (it needs to be sharp so it stings without injuring...you don't want to hit hard enough to hurt the child and you also don't want it to be something that doesn't bother the child at all), that will be much more effective than just swatting at the hand without the context. It's particularly effective if you can maintain eye contact (you may have to demand it at first) for a couple of seconds (at least) after the swat. If the child hits you back and you quit there, the child has won. But if the child hits you back and you calmly grab the hand that hit you, look the child in the eye, say "no hitting!", and swat that hand - basically the same sequence as the first time - the situation becomes totally different. Maybe the child takes you through one more round - or even a few, if the child is unusually stubborn. But if you keep your cool, avoid getting angry, look the child in the eye, and make the punishment consistent and unpleasant without injury, the child WILL soon realize that it's not worth it and he's not going to win, and stop fighting. Then, AS SOON as the child relaxes and stops fighting, give hugs and reassurance.
Note: the punishment does not HAVE to be a swat. Time out works for some children at this age but not all; putting the child down and turning your back or walking away works for some children at this age and devastates/panics others. I have a daughter who hated restraint (just holding her hands and/or feet, as applicable - whatever she had swatted/hit/kicked with - so she couldn't move them) much more than any sort of swat or other punishment. But I have a son who just took restraint as a challenge and it didn't bother him at all. You may have to experiment a bit to find a punishment that works - 1. you can enforce it consistently 2. your child dislikes it enough to change behavior 3. it doesn't cause them to panic or risk injury.
The important thing here is that the child HAS to learn that you are the parent/authority and he is not. If you can establish this early (when you have such a huge size/strength advantage that it is easy to establish without either you or the child being injured), it will reap HUGE dividends later. It's much harder if you wait until the child is 3 or 4 and is capable of injuring you.
In my experience (and I have one son who came to us from an orphanage as a hitter - he already had a sidearm at 15 months old that could actually hurt me if I let him catch me wrong) it can take a lot of patience and consistency, but this DOES work. Now people who know my son can't believe we had a problem with him hitting!
Just my $.02