Gliding birds continually change the shape and size of their wings(1-6), presumably to exploit the profound effect of wing morphology on aerodynamic performance(7-9). That birds should adjust wing sweep to suit glide speed has been predicted qualitatively by analytical glide models(2,10), which extrapolated the wing's performance envelope from aerodynamic theory. Here we describe the aerodynamic and structural performance of actual swift wings, as measured in a wind tunnel, and on this basis build a semiempirical glide model. By measuring inside and outside swifts' behavioural envelope, we show that choosing the most suitable sweep can halve sink speed or triple turning rate. Extended wings are superior for slow glides and turns; swept wings are superior for fast glides and turns. This superiority is due to better aerodynamic performance - with the exception of fast turns. Swept wings are less effective at generating lift while turning at high speeds, but can bear the extreme loads. Finally, our glide model predicts that cost-effective gliding occurs at speeds of 8 - 10 m s(-1), whereas agility-related figures of merit peak at 15 - 25 m s(-1). In fact, swifts spend the night ('roost') in flight at 8 - 10 m s(-1) ( ref. 11), thus our model can explain this choice for a resting behaviour(11,12). Morphing not only adjusts birds' wing performance to the task at hand, but could also control the flight of future aircraft(7).