It is important to figure out why he is swearing. For many kids, it's the thrill of taking a risk (a minor one at that). For some, swearing gives them the attention they want from a parent, even if it's negative attention. For others, anger brings out their worst behavior, which can include swearing. Sometimes, the act of defiance fuels their behavior.
The key things to remember are setting limits (swearing is unacceptable), being consistent in your reaction and punishment, and identifying other words or behaviors that are acceptable when situations bring out the swearing behavior.