You create new product lines. They've done the Apple Watch, Apple TV, Apple Pay, etc..
There's plenty of more options available in both the short (<5yrs) and long term (>5yrs). They've previously had consumer product lines that included cameras, game consoles, laser printers, TVs, etc.. They could revisit those markets again, or push into business markets.
Define your market more broadly. The iPhone itself is an example of this. Desktop computers don't have much growth? Well, what else could a computer be besides a desktop?