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)
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 :
- Tap on the ViewController.swift file in the Xcode’s project navigator (left side of the screen).
- Rename ViewController class name in ViewController.swift file to AppsTopViewController.
- Rename ViewController.swift to AppsTopViewController.swift in the project navigator (left side of the screen).
- Tap on the Main.storyboard file in the project navigator and tap on the ViewController.
- 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.
- 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.