I usually have a quick chat with a lifeguard if there is one, and/or check out what flag system they are using (usually pretty obvious like red/green but it can be different depending where you are). Research a beach on the internet for a few minutes before you go.
http://thevane.gawker.com/learn-how-to-identify-rip-currents...
But how do you know when are out of the rip, so you'd know when to stop swimming parallel?
You can feel it easily if you can touch or swim down to the bottom. Also, it's often possible to see where the sand bars and reefs that are next to the rip are located either by seeing the color of the ocean floor or by seeing the waves breaking; get behind those and you'll be out of the rip.
As surfer we call them lift. They take you out for free, and then it's easy to step out, just as on a lift. But to a swimmer who has no idea they are usually deadly.
You can focus on some constant points, like the surf or some rocks, but usually it's easy to step out, and you feel it immediately.