Yes I have done it, well currently still doing it. It's easiest if you get a truck that is the same year as your truck and hopefully the same engine. That way all the wiring will be a direct swap and all you have to do is transfer over everything.
I did a 1992 body and wiring from a 305 2wd onto a 1989 chassis and 350 4x4 power train. So many differences and unseen changes that I had to do to make everything work so far and I am still not up and road legal yet. Truck runs and drives just not road legal yet.
If the truck has a floor shifter 4x4 you will need to cut the hole for it in the 2wd cab. There are a few fuses that will need to be replaced, a section of harness that needs to be transferred over for the transmission speed sensor I believe, etc.
What are you looking for more specifically in the swap?