Swimming is for the Olympics and the English Channel. The first plan is always to stay in the boat, but if you find yourself having an “out of boat experience” on a rafting trip, the proper technique is more like “orchestrated floating,” than swimming.
The orchestrated part will be explained by your guides when you get to the river, while the floating part is far easier than you may think. After all, you’ll literally be wearing a tightly-buckled Personal Flotation Device (PFD) at all times on the river, in case you have a “personal flotation experience.” Involuntary personal flotation experiences are not very common, but if it happens, you’ll need to be comfortable making active strokes in the water to propel yourself toward a safer place (ie. towards the boat or the shore). Either way, you won’t have to be concerned whether you will sink or float if you are wearing your PFD properly.