Experienced ocean swimmers know all about RIP currents. Some can even spot them from shore, most cannot. For those who don't know what to do when you are swimming in the ocean towards shore and find yourself getting further away rather than closer, here is what to do:
Stop swimming towards shore. You cannot power your way forward against a current for very long before becoming exhausted. Remain calm and don't panic, this is not a big deal if you know what to do. Swim parallel to the shore in either direction until you stop moving outwards. RIP currents are usually not very wide. 100 feet wide would be a really big one.
If you plan to swim in the ocean, you need to Google rip currents so that you may be able to recognize the conditions that create such currents while standing on the beach and so that you know how to get out of one. Every beach has them, especially when the tide is changing. If you swim in the ocean often enough, you will encounter one, even if you don't realize you're in a weak one.
Knowing what to do can save your life.