Refined API Naming : Migrating to Swift 3!

Convert to Current Swift Syntax
Convert to Current Swift Syntax

Xcode 8.0 comes with a Swift Migrator tool that helps you migrate your project to Swift 3, or update it to work with Swift 2.3 and the new SDKs.

Swift Migration Assistant

When you open your project with Xcode 8.0 for the first time, you will be prompted via the migration assistant to do a migration pass. The assistant can also be invoked manually from the menu Edit -> Convert -> To Current Swift Syntax…

You can choose from two kinds of migration to perform:

  • Use Swift 2.3 Modifies your project to enable the Use Legacy Swift build setting and provides source changes to be able to build against the new SDKs.

  • Use Swift 3 This is recommended. You will get source changes to be able to build your project using Swift 3 and take advantage of all the new features in Xcode 8.0.

Optionally, you can move to Swift 2.3 now and invoke the migration assistant again later to update to Swift 3.

Refined API Naming in Swift 3

I found following changes when I was migrating my code to Swift 2.2 to Swift 3.

  1. Instantiate ViewController With Identifier
  2. User Defaults
  3. Open URL
  4. Perform Segue with Identifier
  5. Dequeue Reusable Cell With Identifier
  6. Cell for row at IndexPath
  7. UIApplication Shared Application
  8. String Encoding Unicode
  9. String Encoding UTF8
  10. UIButton set title with state
  11. CGSize
  12. CGPoint
  13. Matches in NSRegularExpression
  14. Pop to root view controller
  15. Hide and show any control
  16. NSTimer to Timer
  17. CGPointZero
  18. Prepare for Segue
  19. Dispatch Queue
  20. UIColor & CGColor
  21. CGSize
  22. Select and deselect any control

And more…

Happy Coding 🙂