是否可以在同一个项目中安装带有Cocoapods的objective c和swift库?

时间:2017-09-09 08:25:19

标签: ios objective-c cocoapods

我想在我的目标C项目中使用以Swift编写的图表(danielgindi/Charts)和用Objc编写的Material Components Material Components

我完成了以下步骤来添加两个库

target 'chart4' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
   use_frameworks!

  # Pods for chart4

  pod 'Charts'

执行了命令pod install

我已将已删除的pod文件移除pod 'Charts'并注释use_frameworks!

target 'chart4' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
   #use_frameworks!

  # Pods for chart4
 pod 'MaterialComponents'

已执行的命令pod update但导致Charts自动删除。我收到了以下回复

Analyzing dependencies
Removing Charts
Downloading dependencies
Installing MDFTextAccessibility (1.2.0)
Installing MaterialComponents (34.0.1)
Installing MotionAnimator (1.1.0)
Installing MotionInterchange (1.0.1)
Installing MotionTransitioning (3.2.1)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There is 1 dependency from the Podfile and 5 total pods installed.

是否可以使用cocoapod安装以Swift编写的图表(danielgindi/Charts)和同一项目中的材料组件Material Components

我的第二个疑问:pod update是将新pod添加到已有现有pod的项目的正确方法。

今天我添加pod'AFNetworking',明天我删除'AFNetworking'(仅从pod文件而非项目)添加'SDWebImage'运行pod更新。 3天后,我删除'SDWebImage'(仅从pod文件而不是项目)添加'图表'。 pod update是实现它的方式吗?

1 个答案:

答案 0 :(得分:1)

使用此功能并执行pod install,您无需删除广告连播'图表'

target 'chart4' do

  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks

   use_frameworks!

      # Pods for chart4

  pod 'Charts'

  pod 'MaterialComponents'