问题描述
这是我的问题:今天我的公司有一个与特定服务器通信的应用程序,但我们收到了为不同服务器开发相同应用程序的需求,因此需要在应用程序中更改一些内容(例如调用的 URL)和标志).
Here's my problem: Today my company has an app that communicates with a specific server, but we received demands to develop this same App for different servers, so a few things need to be changed in the App (like the URL to call and the logo).
我不想创建一个全新的应用程序,其中 99% 的代码都与我的 Xcode 相同,只是为了做到这一点,因为开发新东西真的很困难.
I do not want to create a whole new application with 99% of the code the same in my Xcode just to do that, because it would be really difficult to develop new stuff.
我想知道是否可以通过对不同应用程序进行少量更改来维护相同的基本代码.
I'm wondering if it's possible to maintain the same base code with just small changes to different applications.
希望我说清楚了,谢谢.
Hope I made myself clear, thank you.
推荐答案
只是为了回答我自己的问题,我刚刚找到了这个指南:
Just to answer my own question, I just found this guide:
https://itexico.com/blog/iOS-Mobile-Development-Using-Xcode-Targets-to-Reuse-the-Code
不同的目标和预处理器宏正是我所需要的,非常棒!
Different targets and preprocessor macros are just what I needed, pretty sweet!
这篇关于不同应用程序中的相同代码库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!