commit sample code from Apple.