Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'Swift is not supported for static libraries' when creating a CocoaPod

I created a skeleton pod with pod lib create and I am writing my code into the Development pods > MyPod > Classes group.

I am getting the error Swift is not supported for static libraries.

I haven't really edited any of the other files besides replaced the ReplaceMe.swift and added some others.

Here's the podfile:

use_frameworks!

target 'MyPod_Example' do
  pod 'MyPod', :path => '../'

  target 'MyPod_Tests' do
    inherit! :search_paths


  end
end

What am I missing?

like image 307
xtrinch Avatar asked Jun 10 '16 16:06

xtrinch


People also ask

Does Swift support static libraries?

As mentioned, Apple does allow Swift in static libraries as of Xcode 9 Beta 4.

How do you make a CocoaPod in Swift?

Implement the podIn the project navigator, right click on the SwiftyLab target and select New File... Choose Swift File as the new file template, click on Next … Name the file as SwiftyLib , make sure this file belongs to the SwiftyLib target and save it in the SwiftyLib folder as shown in the screenshot below.

Are CocoaPods static or dynamic?

CocoaPods pod-linkage plugin. In SwiftKey, we have a dynamic framework that we use to share code between the app and the keyboard extension, and all the pods are linked statically except for some of them that are linked dynamically because they are linked to the app and keyboard extension too.

Which is necessary to import them from Swift when building as static libraries?

To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries), you may set `use_modular_headers!` globally in your Podfile, or specify `:modular_headers => true` for particular dependencies.)


1 Answers

Turns out I should have read the tutorial better, it clearly says this:

[!] Note: Due to a Development Pods implementation detail, when you add new/existing files to Pod/Classes or Pod/Assets or update your podspec, you should run pod install or pod update.

It helped with the very uninformative error.

like image 58
xtrinch Avatar answered Nov 03 '22 01:11

xtrinch