To be fair to apple, they're using existing law (riddled with loopholes, albeit) to legally avoid having to pay tax
Apple aren't the only culprits though Google, Microsoft etc all do it as well (pretty much any worldwide technology company that has headquarters in Dublin will be doing it for tax reasons)