Food does not cause swim bladder problems. I kept fantail goldfish years ago and used to feed them extremely well (3-5 times a day) and they never had swim bladder problems. They were fed as much as they could eat during a 15 minute period. They got a variety of different foods and none of them ever had a swim bladder problem.
Swim bladder problems are caused by inbreeding, poor quality fish, deformities, and infections. Fantail goldfish are short bodied fish and their guts are squished up. This includes their swim bladder and intestine. This increases the risk of them having health issues.
Goldfish regularly take in air when eating dry food that floats on the surface of the water. The air travels through their intestine and eventually gets farted out. However, if they have a lot of air in their gut, it can cause them to float around and gives the appearance of a swim bladder problem. To find out if this is the problem, you simply stop feeding dry food for a week and give the fish frozen or live food. If the problem resolves itself when dry food is removed from their diet, then air in the intestine is the problem.
-------------------
Duckweed is a small floating plant that goldfish love to eat. You can grow it outdoors in ponds or containers and add some to the tank each week. or you can grow it in the tank. However, the fish sometimes eat everything in the tank s having some outside gives you a back up supply if this happens.
You can offer them peas, cucumber, zucchini, pumpkin, broccoli, spinach, etc. Just make sure they are free of chemicals and rinse them before use. You can try offering these foods as raw, partly cooked or boiled.
Do not feed onions or onion relatives (spring onion, shallots, leeks, garlic), and no potatoe.