title: Share same assets between multiple targets
body: <p>I'm seeking advice on how to share assets between 4 targets in my project: A.app, B.app, C.app, D.app</p>
  
  <hr>
  
  <h2>Approach 1 - Best case. I have attempted this unsuccessfully</h2>
  
  <ol>
  <li>Create an Assets.bundle target.</li>
  <li><p>In the 'Run Script' phase, copy files from Assets.bundle into the *.app targets, like this:</p>
  
  <p>cd "${BUILT_PRODUCTS_DIR}"
  ls Assets.bundle | sed '/Info.plist/d' | xargs -t -I {} cp -r Assets.bundle/{} "${CONTENTS_FOLDER_PATH}/"</p></li>
  </ol>
  
  <p>However when I run the app, the UI looks wrong. The .xib's gets loaded, but no images gets loaded! The image files and nib files seems to have been copied correct into the .app folder. My hypothesis is that a compiled .nib file assumes that it's located inside the Assets.bundle folder, thus explaining why it doesn't work when it's located outside the Assets.bundle folder.</p>
  
  <p><strong>Am I missing something in this approach?</strong></p>
  
  <hr>
  
  <h2>Approach 2 - Untested</h2>
  
  <p>Make a Assets.xcconfig file that is #imported by the {A,B,C,D}.app targets.</p>
  
  <hr>
  
  <h2>Approach 3 - Untested</h2>
  
  <p>Mirror the 'Copy Bundle Resources' from the A.app target to the {B,C,D}.app targets</p>
  
  <p>With a ruby script I can update the 'project.pbxproj' file.</p>
  
  <hr>
  
  <h2>Approach 4 - My current approach</h2>
  
  <p>Maintain 'Copy Bundle Resources' manually on {A,B,C,D}.app targets. </p>
  
  <p>EDIT: I want to abandon this 'Target Membership' approach, because it's a big project and multiple people are contributing.</p>
  
  <hr>
  
  <h2>Approach 5 - Worst case</h2>
  
  <ol>
  <li>Create an Assets.bundle target.</li>
  <li>Copy the Assets.bundle folder into the *.app targets.</li>
  <li>Change all [NSBundle mainBundle] code, so it uses the Assets.bundle instead.</li>
  </ol>
  
  <p>In this project I have >1000 image files and >150 .xib files. There is much legacy code that uses hardcoded path lookups. Rework will take time. I have done this change on small project. This is a very elegant solution. However a rework of this size will take lots of time.</p>