When my autistic teen was younger, we didn't deal with swearing, but he yelled a lot. I am thinking that while the behavior is different, the solution might be the same. What we did was correct him constantly. He would get frustrated and yell, or get angry and yell, or get confused and yell (you get the picture), every time we would calmly say, "Use your words." In your son's case, I would give him the words. For example, if he drops something and starts to swear, I would say "you dropped something, oh no". Try not to react to the swear. Be persistent and patient. Hopefully, over time, by not getting a reaction to the swear word and learning replacement words, he will stop swearing.