Reputation: 13713
I'm trying to import a swift file from https://github.com/codestergit/SweetAlert-iOS/blob/master/SweetAlert/SweetAlert.swift into an existing objective-c project.
After adding the file to the project I try to compile (just adding the file without doing anything else) and I get the following build error:
Swift is not supported for static libraries
I'm new to swift, and don't see how this library is marked as static and what I should do to change it and make it compile - I don't need it to be static.
how can I solve this?
Upvotes: 3
Views: 2653
Reputation: 932
The current runtime doesn't ship with the OS, so static libs would lead to multiple runtimes in the final executable. See more https://twitter.com/owensd/status/555060783407591424
Upvotes: 0
Reputation: 3274
the problem occur because you use the swift code for the objective-c project.you will find the file under podsTarget pods/XXXX/XXX is swift file. for example use pod 'ReactiveCocoa','2.1.8'instead of pod 'ReactiveCocoa'
Upvotes: 0
Reputation: 3031
You will have to either add the Swift file to a framework or an application.
Due to problems with importing Swift information from static libraries, Apple hasn't implemented building and linking static libraries that have Swift code.
Upvotes: 1
Reputation: 534885
just adding the file without doing anything else
I don't know what you added or where you added it. But what you want to do is add just the SweetAlert.swift file — nothing else — and you want to add it to your project as part of your app target.
You will then also need to accept the dialog that creates a bridging header, and import the hidden bridging header into your Objective-C code that wants to call this code.
Upvotes: 0