refactor(ios): refactor code for clearing data (#1137)