It is a sign of maturity and intelligence to display the ability to moderate your behavior for the circumstances you find yourself in. You wear a suit to a wedding, but shorts to the beach. The same is true with language. People will respect you more if you understand the difference between swearing in the office and swearing at a backyard barbecue with your oldest friends.
Also, attempting to be offensive just for the sake of being offensive is manipulative behavior, and most people will recognize this and respond to you accordingly. If you can't communicate appropriately and effectively, it will affect your relationships with people, and this is true whether you're swearing or not.
I would add that one should avoid swearing around people that one doesn't know well -- people that you've just met at a party or on vacation, for example. One should also avoid swearing in the office, as a general rule, even when among friends.