Can I copy a storyboard from one project to another project?
Solution 1
Yes you can, just make sure they are selected as your main storyboards as per image below.
Solution 2
As @Muhammad said you can and it is very simple!
- You just have to drag the Storyboard file from one project to another and select all options (The same procedure as importing anything else!).
- Next, you just need to go to your project options by clicking on the project icon in the left upper side of project navigator.
- Then you just need to select this storyboard to be your storyboard and that's it.
Solution 3
Method 1
Select the View Controller in the storyboard and press Command + C to copy. Then press Command + V to paste in the second storyboard. Check the document outline to see where it was pasted to.
Method 2
Right click the storyboard file in the Project Navigator and select Open As > Source Code. Scroll down the XML code until you find your View Controller. It will look something like this:
<!--My View Controller-->
<scene sceneID="tne-QT-ifu">
...
</scene>
Copy this and paste it in the second project's storyboard file.
Notes
- You must also copy over the view controller swift file, of course, but the outlets shouldn't need to be reconnected.
Solution 4
It's simple. Just follow these steps:
- Press cmd + D while selecting your desired storyboard scene. It will create a duplicate copy of your selected scene.
- Press cmd + x to cut the scene from the existing project.
- Press cmd + v into the storyboard section of the second project.
Cheers.
001
Only questions with complete answers are accepted as solutions.
Updated on July 09, 2020Comments
-
001 almost 4 years
To reuse a storyboard, could I simply copy it from one project to another project (then make modification to the storyboard as required)?
-
001 over 10 yearsWhat do you mean by selected as your main storyboard? @Muhammad
-
John Henckel almost 10 yearsThis sorta works, but not really. When I click the tuxedo it does not let me Ctrl_Drag to connect items from the view to the controller. How can I fix it?
-
John Henckel almost 10 yearsI had to open the storyboard XML in textedit and change the name of the "customClass" of the view controller.
-
Luke Smith about 4 yearsMethod 2 : This is the only thing working for me with XCode 11 - everything else makes it crash. Thanks!