In this Swift Tutorials : iOS PROGRAMMING WITH SWIFT TUTORIALS AND LESSONS lesson we will tell you how to rename ViewController swift from Scratch using Swift and Xcode (We made it in Xcode 8 using Swift)

Follow Along

Open Xcode > New Project and select Single View Application

In the Product Name Type the following : renameViewController

Let’s say we want to rename the default ViewController to AppsTopViewController.

To do this :

  1. Tap on the ViewController.swift file in the Xcode’s project navigator (left side of the screen).
    rename View Controller
  2. Rename ViewController class name in ViewController.swift file to AppsTopViewController.
  3. Rename ViewController.swift to AppsTopViewController.swift in the project navigator (left side of the screen).
    Rename ViewController Swift
  4. Tap on the Main.storyboard file in the project navigator and tap on the ViewController.
  5. In the Utilities pane of the Xcode (right) choose Show the Identity Inspector Tab and change Custom Class > Class field to AppsTopViewController for selected ViewController.
    renameViewController3

    renameViewController3

  6. Run your app in a Simulator or Real device to see that there are no errors.

Task Done, if you need to rename other view controllers, just implement the same technique.

Try more Swift tutorials at 👉 Swift Tutorials Navigation

This lesson (Rename ViewController Swift) is a part of Swift Tutorials and Lessons created by the Apps-Top.com Team. Feel free to save and share this post to social if you find this lesson useful or helpful.