Moving Files into a Real Folder in Xcode

前端 未结 12 974
北恋
北恋 2020-12-02 03:20

When I started my project I was happy to use Groups in Xcode rather than literal folders: Since I\'m using the browser in Xcode to access everything, stuff was nicely organi

相关标签:
12条回答
  • 2020-12-02 04:18

    In Xcode 5 or Xcode 6:

    1. Create the folders that map to your Groups in Finder
    2. Move the files into those folders in Finder
    3. Select each file that is red in the Xcode sidebar on the left
    4. Click the button "Show/Hide Utilities" to reveal the right sidebar (see figure)
    5. In "Identity and Type", click the tiny button and select the file location (see figure)

    enter image description here

    Cheers.

    0 讨论(0)
  • 2020-12-02 04:18

    There is a simple to setup and use Command Line Tool - "synx" available in github that do exactly what is needed here.

    It reorganizes Xcode project folder in finder to match Xcode groups in project.

    You can find it here: https://github.com/venmo/synx

    UPDATE: XCode 9 supports this feature by default. So, no need to use other tools anymore!

    0 讨论(0)
  • 2020-12-02 04:20

    Easiest technique for XCode 8....

    Assuming you have files A,B,C in a logical group, but want them moved into a folder on your hard drive.

    1. Create a destination folder via Finder
    2. Add the folder in XCode (File -> Add Files ) using the Options pane to select a Folder Reference (not a group)
    3. Drag files A,B,C from the (old) group to the (new) folder reference in the project navigator. XCode will move the files into the folder, both in the the project, and on disk.

    Done.

    0 讨论(0)
  • 2020-12-02 04:21

    To move a folder in xcode 4.5 I just...

    1. Delete the files/groups from xcode and select "Remove Reference".
    2. Go into finder and move the folder/files as needed.
    3. Once done I go back into Xcode and choose File->Add Files to {ProjectName}.
    4. Make sure "Copy Items into Destination Group's folder (If needed)" is checked
    5. Make sure "Create Group for any added folder" is checked
    6. Make sure "Add to Target" is checked for your project
    0 讨论(0)
  • 2020-12-02 04:22

    On XCode 11 (I just validated this on XCode 11.6), you can select the files you would like to move under the project navigator, right click on the selected files, and click "New Group From Selection". This will create a folder on disk and move the files appropriately.

    0 讨论(0)
  • 2020-12-02 04:23

    As of Xcode 4.5 when you drag in a folder structure it is automatically turned into nested groups in the Project Navigator. Then, if you look on disk (e.g. right click and choose Show in Finder), the folder structure has been retained.

    I found trying to fix things from an older project was just a pain. It turned out much easier to just delete these files and drag them in again.

    0 讨论(0)
提交回复
热议问题