elcool
elcool

Reputation: 6161

How to copy a XIB to another project?

Simple. I have two projects in Xcode. In one of them I made a .xib file and I want to copy it to another project, so as to save some time redoing it.

I can't drag it to the other project, nor do copy/paste by command, nor copy/paste by the Edit menu.

Any suggestions?

Upvotes: 3

Views: 5238

Answers (3)

DevB2F
DevB2F

Reputation: 5095

Here is how I managed to do this with XCode 10.2.1

  1. Close the XCode project with the xib file you want to copy.
  2. Drag the xib file from finder over to the new project. Make sure you tick the copy items if needed box.
  3. If the xib file uses images for outlets, also drag the images to the new project.

There is no need to reconnect the outlets.

Upvotes: 2

Tibidabo
Tibidabo

Reputation: 21571

Just drag and drop from one project window to the other.

Make sure that you check the "Copy items to the destination folder"

If you have more than one targets make sure that you check the appropriate target when you add it.

You probably have to reconnect all of your outlets, and if it crashes for some reason it means that there are connected outlets/actions which are not available in your code.

Upvotes: 4

skorulis
skorulis

Reputation: 4381

Go into finder, find the .xib file and copy it to the directory of the second project. Then uses add existing files to add it to the second project.

Upvotes: 6

Related Questions