A 29-year-old man was airlifted to hospital in a stable condition on Saturday after being attacked by a shark while swimming at a beach on Moreton Island about 40 km off the coast of Brisbane.