I don’t write YA, currently anyway, so my opinion is more for adult fiction, though I might venture into YA at some point.
Anyway, I agree with Sarah in that any swear words should be appropriate and natural to the character, setting, and plot. In my paranormal romance series, one half of my main couple is almost always an Enforcer – roughly equivalent to a special forces soldier, or a law enforcement rapid response team member. They tend to swear regularly. 😉
One of my Enforcers, from a currently shelved manuscript, was of noble birth, raised in a time when coarse language was frowned upon for the nobility. His worst swearing was an occasional ‘damn’ in extreme circumstances, when it looked like the bad guys were bound to win.
The MMC in my current WIP is a heavy metal musician and a 300+ yr old vampire. The F-bomb is part of his everyday speech patterns. The FMC is the Enforcers, and her language is less ‘colorful’, but hell and damn are her most frequent swear words, and it takes more to make her swear.
I’ve read books where the swearing seemed to be more for shock value than any real purpose of the plot or character. To me, that’s as bad as the soldier in desperate combat who confines himself to ‘golly’ or ‘darn’ just because the writer doesn’t like swear words, or thinks the potential readers wouldn’t.