I have a storyboard with 6 view controllers. I want to duplicate one of them (I essentially want to cut half the functionality out of the original VC and put that into the second VC.
In the storyboard a copy/pasted the existing VC1. In Finder, I copy/pasted the .swift file of VC1 to a new file that I called VC2. Back in Xcode 9.4.1, I added that VC2 file to the folder in the left hand nav pane. I clicked on VC2 in the storyboard and changed its custom class to VC2.
VC1 has a custom class of VC1 and even a StoryboardID of VC1. VC2 has a custom class of VC2 and even a StoryboardID of VC2. I thought the StoryboardIDs would help fix this situation.
In the Storyboard, I can clearly see VC1 and VC2. They are labeled appropriately. Even the window pane to the immediate left is fine!
In the Storyboard, if I click on VC2, the Assistant Editor automatically switches to VC2 and I see the code.
But... in the Storyboard if I click on VC1, then the Assistant Editor does not switch to VC1. I have to click the word/button: Automatic, which now says (2) and choose VC1, then it will switch the code to VC1, but then I have to click VC1 again in order to have the identity inspection to list the correct stuff.
I have clicked Product -> Clean and then Product -> Build and then restarted, but it doesn't change anything
I know that I still have to cut up and edit my VC's, but the app is working (VC2 isn't segued in yet).
Can we duplicate VCs this way? Is there a way to get the automatic assistant editing to switch accordingly?
Thanks
Delete the VC2 .swift file. Create a brand new VC2 .swift file, then copy and paste the CODE ONLY. This should avoid Xcode getting confused between VC1 and VC2.