Completed Coding for ios Side.