Moved iOS functions into a separate file.