Basically they suck profits into Ireland, by stating in other EU countries that they will pay corporate taxes there; then in Ireland through "IP licensing fees" they paid all the money into a company that was declared not resident on the island for tax purposes, and was basically stateless - so not taxed. That company would then send this money to the various Caribbean shells they use as safes, when necessary, or just hang on it.
When the EU told Ireland to stop this behaviour, Apple was pushed to declare a location for that stateless company; they picked one of the UK Channel Islands, a crown dependency with no taxes, and started funneling money through that. In the process, they got another special deal from the Irish government to keep a chunk of "IP ownership capital" on the island, which resulted in a much lower rate of tax on that money than they would have otherwise had to pay (but ever-so-slightly higher than if they had just put everything in Guernsey, so they could save a bit of face).