To move code from UIKit to Swift, follow these steps:
For example, to convert this UIKit code:
240 chars6 lines
To Swift code, you would do this:
294 chars10 lines
Note that self
refers to the current view controller in UIKit, but because we are now using Swift, self
is inferred automatically.
By copying and modifying the relevant parts of the UIKit code, you can gradually refactor your code to use Swift.
gistlibby LogSnag