I used clear PLA to make this cupholder so that it would be easier to see if exposure to sun and weather is degrading the PLA -- I just made this, so I don't know how long it will last. The only aspect of the part that's difficult to print is the top edge of the cylindrical cut that goes over the metal bar of the swing to mount. However, a few dropped threads are harmless here, and by printing the outer part of the clamp in the different orientation (see the STL file), the cylindrical section becomes easy to print and the orientation of the extrusion becomes better for providing good clamping force. To ensure good strength, I printed this 25% filled. The walls of the holder are not very tall, which keeps it from hitting the handle of most mugs. This is primarily intended to provide a solid base... by the way, the base of cupholder isn't literally solid because we don't want spilled drinks collecting there, do we?
Swings don't actually standardize the design of the bar that we're clamping to, and cups & cans don't really have a standard diameter either, so you might need to modify this design. The bar on some swings is not cylindrical, in which case you'll need to modify the clamp shape. For that matter, this design can clamp onto any similar bar, not just part of a swing. Soda cans are about 66mm diameter, but I made this to hold up to 85mm diameter.
The clamping mechanism is intended to use a 1/4 20 bolt, which is worked through the obvious hole in the part from inside the cupholder (it isn't threaded, but is a tight fit). A washer and a nut or wingnut are used to tighten the clamp.
Although this part works, I strongly suspect I'll be modifying the design to have the cup sit directly above the metal bar... which is why this is marked as a work in progress.