简体   繁体   中英

Sharing a File Among Xcode / iOS Projects

I have several iOS apps that rely on a common class (ie MyClass.swift). Rather than copy MyClass.swift into each project subdirectory, I would like to configure Xcode to understand that the file resides on my desktop but should be considered an essential part of each project for developing, building, running on simulator, running on device, archiving, and uploading to the App store.

Is it possible to achieve this without using a Library, Framework, or third-party dependency manager?

i usually create a separate repository for the common class. when adding the common class to other projects i make sure to deselect "Copy items if needed".

now each project points to the same file and any changes made by a project to the common class immediately changes the code for all projects. changes made to the common class should be committed to its own repo.

this approach has some downsides (repositories for the separate projects would require you to manually pull down the common class's repo), but these could be mitigated by using submodules

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM