How do I create a bundle of reusable code in Xcode?

后端 未结 1 1143
慢半拍i
慢半拍i 2021-01-30 23:17

I am developing an iPhone app and have to parse xml files in order to put them into a database. I will also be using those same xml parsers in my app so users can import their o

相关标签:
1条回答
  • 2021-01-31 00:14

    Create a static library project, then use the interproject dependency feature of Xcode to build them in the correct order and link the app with the static library. You'll need to have a common build directory set for all the projects for this to work correctly (at least you did around Xcode 3.0, didn't check if this is still a problem with 3.1).

    You can set the build directory from the target or project's build settings (in the Get Info pane). To create an interpoject dependency:

    • Drag the library project into the application project's Files & Groups pane.
    • Set up target dependency in the application target's Get Info pane. Make it dependent on the library's target.
    • Drag the library product in the application target's Link With Libraries step. You can find the library product by expanding the library project within the app project's Files & Groups (click the arrow).

    Sounds more complicated than it is. It isn't much.

    (Small extras: yes, you need a common build folder as indicated in the Xcode Project Management Guide, and the Xcode Build System Guide can help you "get" Xcode's build system, which -- at the cost of starting a religion war -- I think is one of the most flexible and simple build systems out there.)

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