It sounds like you made the right decision, "swim sideways" is what I have always heard to do if you find yourself in a rip current. I have luckily never had to use that information, but whenever I'm at the beach I try to repeat it to myself just in case, so at least hopefully it's somewhere readily accessible to my animal brain if it becomes important for survival.