I broke some ribs a few years ago, and all I could manage was riding on the trainer. But I did a lot of that (3-5 hours per day) and I think the exercise accelerated my healing. I’d walk uphills to keep some run shape, but I could only swim (with the help of a snorkel) after 4 weeks. After week 4, healing was very fast and I managed to still do my Ironman race at the end of week 5.
Not sure about swimming or running, but you can ride.
Just have to HTFU and be ok with staying seated all the time and taking short breaths.
I broke, bruised and tore up some intercostsals a few years ago.
I was back to full training right away (see above for limitations). It hurt pretty good for about 1 month, and to a lesser degree for a second month.
Be careful as it is easy to reinjure ribs and soft tissue around them.
Several months later I was forcefully pulling a grip off of my mountain bike- I popped it loose again!
Everything will really hurt for the first few minutes, then not be so bad after your natural painkillers kick in. (Source - I trained for and ran an ultra with busted ribs)