I once stood on a rock outcrop on the west side of Oahu and watched the water move in and out. I stood on the edge of a cliff. When a wave came in, the ocean water would splash my feet. When the waves rolled out, I watched the water level drop 40 feet. Seriously, 40 feet...
I realized in that instant that I may never again witness such raw power.
Additionally, I realized that there is no way to fight water currents. They weigh more than me. They are stronger than me. They can last longer than I can.
From the perspective of a diver, hydrostatic pressure is unstoppable.
You don't fight the power of the ocean, you learn to use it.
So with that said...
If you find yourself in a current that runs parallel to shore, you swim towards shore, in a downstream/diagonal pattern.
If you find yourself in a current that runs perpendicular to shore (a rip tide), again, swim towards shore, in a downstream/diagonal pattern. In all instances, use constant, non-exhaustive efforts.
In rivers, I have encountered whirlpools and currents that push and hold me down (I forget what that is called). Remember, unless the waterflow moves into an underground tunnel, you will eventually be pushed to the surface. Eventually, the hydrostatic pressure will win. The key is to maintain air supply (hold your breath when free diving, or conserve air if scuba diving) until that occurs. In river diving, let the water win. If you are using air, relax and let the pressure move you. If you are skin diving, hold your breathe, follow the current, and work for the surface.
If you are ocean diving and you find yourself being swept out to sea, deploy a die pack, and pray. Did I mention, bring a die pack?
Most importantly, know the water conditions before you get wet. If conditions are dangerous, stay dry, and live to dive another day. It is always better to be watching TV, wishing you could dive, then to be sitting in the ocean, wishing you could watch TV.
Does that help? Or am I just rambling on a tangent?