THE first iPhone went on sale on June 29th 2007. Tom Sun recalls the date easily, because TPK, of which he is the chief executive, began manufacturing exactly four weeks before, making touchscreens for Apple’s gadget. This year, Mr Sun estimates, 1.2 billion mobile phones will be made with touchscreens. The iPad has since “created a segment”, the tablet, that he says is “100% touch”.

TPK’s booth at Computex, a trade fair in Taipei last month, proudly showed off the latest notebook and all-in-one personal computers (PCs). But Mr Sun enthuses about many more applications, from cameras to cars. Other manufacturers, he says, will follow Tesla, an electric-vehicle maker that has put 17-inch screens in its Model S.

Taiwan, once a maker of soft toys and umbrellas, has long been a high-tech hive. It provides a rare example of successful industrial policy (though much more so in hardware than software). In 1973 the state created the Industrial Technology Research Institute (ITRI) to nurture the tech industry. ITRI started with semiconductors, securing the transfer of old technology from RCA, an American company, in 1976. In 1983 ITRI developed a clone of the IBM PC. Seven years later it formed an alliance of notebook-PC companies. Information and communications technology now makes up one-third of GDP.

The island came to dominate the notebook business. The Market Intelligence & Consulting Institute (MIC), a research group in Taipei, says that its companies make 89% of the world’s notebooks, as well as 46% of desktop PCs. These days they make them mainly with Chinese labour: 94% of their hardware, by value, is produced on the mainland. But demand for PCs has plunged. Shipments fell by 13.9% in the year to the first quarter, according to IDC, a research firm. People would now rather buy smartphones or tablets.

For some Taiwanese companies, the change in computing fashion has been a boon. One is TPK, although it suffered a sales wobble in the second quarter as demand for the new touchscreen notebooks proved softer than expected. Another is Taiwan Semiconductor Manufacturing Company, a chip “foundry” spun out of ITRI in 1987. TSMC makes chips by the bucketload for designers such as Qualcomm, an American company which provides the brains of more smartphones than anyone else, and MediaTek, its neighbour in Hsinchu, which sold 110m smartphone chipsets in 2012 and expects to sell 200m in 2013.

The change is a sterner test for firms that built their success on the PC. Taiwan has two PC-makers, Acer and ASUSTeK, in the world’s top five brands, but the industry is much bigger than these two. It mostly comprises anonymous “original design manufacturers” (ODMs) making machines for Hewlett-Packard, Dell, Lenovo and others, as well as for Acer and ASUSTeK. Quanta is the leading notebook-maker; behind it are Compal, Wistron (originally part of Acer), Pegatron (once part of ASUSTeK) and Inventec (see chart). Hon Hai, also known as Foxconn, is the best known abroad, but chiefly as a maker of iPads and iPhones. It manufactures much else: its revenue is almost four times Quanta’s. ODMs’ margins are low: 3-5% gross and 1-2% at the operating level. That is fine when volumes are high, but some firms have suffered declining revenues. Inventec’s fell by 20% between 2009 and 2012. Worse, the margins have been thinning.

Going where the growth is

Attempts to breathe new life into the PC have so far been disappointing. Granted, at Computex Intel, maker of the chips that power most PCs, showed off a new, energy-efficient processor, while Acer and ASUSTeK paraded ingenious touchscreen designs. But even if all this lifts sales later this year, the glory days of the PC are over.

The leading ODMs have realised that they cannot rely on the PC for ever. One option is to go where the growth is: mobile devices. Of the notebook specialists, Pegatron has been most eager. Its computing division, which includes PCs, now accounts for 40% of revenue, down from 50-60% two years ago; the share of consumer electronics, which includes tablets, has doubled in a year, to over one-third.

Pegatron has also become less dependent on its former parent, ASUSTeK. Other clients used to worry that the pair were still too hugger-mugger. Tracy Tsai of Gartner, a research firm, says having to look elsewhere for orders has been good for Pegatron. Its revenue jumped by more than 40% last year whereas other ODMs stalled. It is said to be winning more work from Apple, at Hon Hai’s expense.

However, the mobile market is fiercely competitive, and not only among the ODMs. At the high end the Taiwanese must contend with South Korea’s giant, Samsung. At the bottom a multitude of Chinese manufacturers are turning out cheap, unbranded Android tablets of fast-rising quality. MIC expects that this year Taiwanese makers’ share of tablets will drop to 53%, from 69% in 2012. The trick will be to keep far enough ahead of the Chinese on quality to justify higher prices.

Hon Hai already thinks that iPads and iPhones may be too much of a good thing. It wants to reduce its reliance on Apple, the source of perhaps 40% of its sales. It is moving into retailing and wants to develop its own technology, for which it intends to hire another 5,000-10,000 engineers in Taiwan. On July 2nd it said it had applied for a licence to operate fourth-generation mobile-telecoms services in Taiwan. A week before it said that it would spin off its connectors division and perhaps others.

Another option is to make servers, to store and process data from all those mobile devices. Quanta began doing this several years ago. This year its server division is expected to produce 10% of its revenue. It is no longer just an ODM: 85% of its servers are sold directly to the final customer, according to CommonWealth, a Taiwanese magazine. Its clients include Facebook, which has gigantic data centres to fill.

Servers are helping Inventec to make a recovery. In the first quarter they accounted for a quarter of its sales; and so far this year its total revenue is up by 25%. It seems to have stuck with the ODM model. Its clients include HP—which, reckon Kirk Yang and his colleagues at Barclays, a bank, also takes 60% of its notebooks.

Wistron has been branching out too. Six years ago, Patrick Lin of Wistron says Simon Lin, the chief executive (no relation), asked him to evaluate ways of turning the company from an ODM into a broader “technology service provider”. Wistron spread into cloud computing, after-sales service (of which it already did plenty), medical equipment and recycling—which Patrick Lin now runs. Late this year or early next Wistron will open a facility in Texas for recovering precious metals from computers and smartphones. In Kunshan, in China, it can recycle 60,000 tonnes of plastic a year. Together the new areas account for 10% of revenue.

“Taiwanese companies can adapt in a very short time,” says Chris Hung, an analyst at MIC. They have done so before, such as when they moved production to China to take advantage of its big, cheap labour force. Up against Chinese capital as well as labour, not to mention the South Koreans, they must do so again.