recursive-iterative factorial function in swift