If you are a strong swimmer and the rip current is only one or two knots, then a sprint for the shore against the current will very likely succeed, but if you find you are making no headway and becoming tired, better to go with the flow. There is no way of judging the speed of the current until you pit yourself against it. For a weak swimmer, this will be very alarming, so he should concentrate on keeping afloat and let the current carry him in a circle. With luck, the people on the shore will organise a rescue.
If the current has carried you right around and you find yourself approaching the shore, it would probably be worth making an attempt, this time with the current instead of against it, to sprint for the shore. There are sometimes notices on the shore warning against dangerous currents. Read these notices before going into the water.
Diving in a straight line in such a regime is near impossible, because sight is obstructed. A specially trained free diver may have more of a chance but will have to go to the surface several times.
Now let's assume that an unlucky swimmer finds him-/herself in exactly the depicted situation and quickly analyzes and realizes what's going on (unlikely). If they are cold blooded enbough they can try and swim to one side, then with the stream either once around or back again towards the beach. But ... things aren't usually like in a picture book. There are coast parallel streams, waves and rocks can make it difficult to get out of the water unhurt, and maybe the stream turns too far outside or not at all. There may be undertow or a breaking wave throws the swimmer on the rocks. And when outside, even in 20° warm water the survival chances are low, until a helicopter or the rescue boat arrive. And even then, finding a head of a swimmer between the waves is pure luck for the rescue forces. People have actually drowned in the middle of regattas and dense trafic searching for them. That is why it is strictly forbidden to go overboard ;-)
There is a reason why people do die in such or similar situations. In any case, the answer to your question is "Yes", a swimmer can easily find himself in a situation where reaching the land is impossible. A snorkler with fins may have better chances.
Edit: just so that you know what i am talking about, 3 random videos. Medium conditions, waves 1-2m. Dynamic conditions, waves 6-8m. Calm conditions, .5m waves.