Apple shares have firmly outperformed the S&P 500 and the Nasdaq since its artificial intelligence event in early June.