In the far north, solar can work very well to provide supplemental heat during swimming season. Say your water is 70 degrees in June, using solar to boost that up to 80 is quite practical.
In the far north, solar works less well to extend the swimming season significantly into the spring/fall. This can be done with very large panels, and/or panels using evacuated glass tubes, but there are challenges that make it more complex/impractical for most people. For example conventional panels run risks from sudden cold snaps and are less efficient at low air temperatures. Evacuated glass tubes can still work even at low air temperatures but they cost significantly more and the plumbing still needs to be protected from freezing (which limits your season length).