Swift to objective c port

Completed port from swift to objective c. Everything should be working as it was before.