All the code rewritten from Objective-C to Swift