The title might throw you off, but yes, there are times when swearing can be great for your book. For example, if a character shows an extreme amount of any emotion I would pop up a swear word there. Of course, if you are writing a kids book (ages 9-12) I would keep the cussing to a minimum. Although, if you are writing a YA novel (ages 13+) then I would suggest to up your language.
In my book, there are certain points in the book where characters are extremely sad or angry, and I used cuss words in these moments to make the scenes more realistic.
This does not mean that you should put in the F-Word in every single sentence, because most people hate people who talk like that. It's horrible! Any who, I would definitely use it to your advantage in YA novels, but keep it so the reader does not feel overwhelmed. Example: "Fuck it! I'm jumping off that cliff."
This is a very appropriate sentence(s) to use that word in; it gives the reader a clear image of what the character is feeling. Of course, if you want it a little more PG "Screw it!" might be a little more your style.
this is where i ramble; have fun