I don't think it is ever ok to swear at children
I was in a store once and a lady with a baby in a stroller and a little girl suddenly stated yelling at the storeperson "**** you, you c***. You can shove your pathetic customer service up your fat a*se. You are nothing but a fat s*ut and I hope you crash your car on the way home coz at least that will improve your dog ugly face"
I was so shocked that I just stared slightly opened mouth at her. The lady's friend was laughing away and slapping her on the back. Her little girl was just wide eyed standing there. Poor poor child