将现有项目转换为可定制的框架 [英] Converting an existing project into customizable framework

查看:64
本文介绍了将现有项目转换为可定制的框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一名Android开发人员,需要创建IOS应用程序.所以我做到了,现在应用已经准备就绪.但是现在我要使其成为库/框架.我的意思是相同的代码库将在每个客户端的不同项目中使用,它们将能够更改应用程序的文本字符串和颜色.其余业务逻辑将保持不变.

I am a android developer and I needed to create and IOS app. So I did and app is ready now. But now I want to make it a Library/Framework. I mean a same code base will be used in different projects per client and they will be able to change the text strings and colors of app. The rest of the business logic will be remain same.

所以我有两个主要问题:

  • 如何将项目转换为框架?我是否需要在其他地方创建单独的框架,然后将项目作为Coca touch框架导入其中?我说的对吗?
  • 如何使其可定制?我从Customizable的意思是简单的两件事.
    • 1)视图的颜色.我有两种观点.我想要一个单独的颜色文件,以便可以更改颜色并反映整个应用程序中的更改
    • 2)字符串.我想更改文本字符串,以便可以在所有项目中进行更改.
    • 请告诉我如何实现这些目标.特别要注意的是第二点.

      Please tell me how can I achieve these things. Specially point number two is my main concern.

      注意:我要在框架中转换的项目有两个很多viewController,并且都建在一个情节提要中.

      Note: The project that I want to convert in framework has two many viewControllers and all are built in one storyboard.

      推荐答案

      关于如何创建框架,以下是我的操作方法:

      With regard to how to create a framework, here's how I'd do it:

      1. 创建工作空间:

      1. Create a workspace:

      通过从Finder中将您想要变成一个库的项目拖入该工作区(执行此操作时,请确保它未在XCode中打开).我们将该项目称为FrameworkProj:

      Bring the project you want to turn into a library into that workspace by dragging it in from the Finder (make sure it's not open in XCode when you do this). Let's call that project FrameworkProj:

      为Cocoa Touch Framework类型的FrameworkProj创建目标:

      Create a target for FrameworkProj of type Cocoa Touch Framework:

      创建第二个项目,我们将其称为SampleProjWhichUsesFramework,并将框架导入其中.

      Create a second project, which we'll call SampleProjWhichUsesFramework, and import the framework into it.

      关于您是否可以通过框架设置IB元素的问题,只需确保对标记为公共的那些元素有IBOutlet,它们将作为您框架的属性提供给SampleProjWhichUsesFramework.

      As for your question of IB elements being settable via the framework, simply make sure you have IBOutlets for those elements that are marked public, and they will be available to SampleProjWhichUsesFramework as properties of your framework.

      这篇关于将现有项目转换为可定制的框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆