Git Product home page Git Product logo

framework-demo's Introduction

iOS Framework工程中添加测试工程

需求描述

在一个工程中同时包含Frameweork工程、demo测试工程、并且能使用cocopods导入三方库。 项目结构如图所示
项目结构.jpg

工程构建步骤

步骤1:创建demo工程
  • 创建demo工程、如上图所示工程为testFrameworkDemo
步骤2:创建framework工程
  • 创建framework工程、如上图所示工程为Framework (创建新的项目)
步骤3:初始化pod
  • 初始化cocopods:在testFrameworkDemo 中初始化pod init
步骤4:关联项目
  • Framework文件夹放入testFrameworkDemo 文件下,并且将Framework.xcodeproj拖入testFrameworkDemo工程。如图 文件目录.jpg

拖入.jpg

勾选.jpg

步骤5:设置podfile
  • 设置podfile
# Uncomment the next line to define a global platform for your project
 platform :ios, '9.0'
 
#这里需要添加
workspace 'testFrameworkDemo.xcworkspace'

target 'testFrameworkDemo' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for testFrameworkDemo

pod 'MJExtension'

end

target 'Framework' do
#这里需要添加
  project './Framework/Framework.xcodeproj'

pod 'MJExtension'
  
end
步骤6:工程联调
  • 打包设置不赘述
  • 在demo中需要使用的时候,先在framework工程中command + B
  • demo中引入头文件#import <Framework/Framework.h>

github链接 Framework-demo

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.