Swimming is fantastic for shoulder stability, strength and mobility. Its great for a cardio workout, and its low impact.
Exercising in water, including swimming, is great to way to increase the range of mobility of the shoulder. If you shoulder is just stiff, but not painful, front crawl and backstroke are great strokes to extend the range of movement.
Breastroke is the safest of the strokes, because unless your shoulder is very stiff, you should be able to keep the shoulder well within its comfort zone.
Butterfly is the stroke that should be avoided for any shoulder pain sufferer as you are very likely to take your shoulder beyond its comfortable range.