Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intermittent Swift Framework Compiler Error

Tags:

ios

swift

xcode6

I am trying out Swift in the XCode beta. In particular using an @IBDesignable and @IBInspectable. I am building a framework containing an (@IBDesignable) UIView subclass and a Simple iOS App in order to test it out (Both contained in and linked via a workspace). After a few successful builds I get the following error in the framework build output:

:0: error: /Users/richardpj/Projects/Swift2/Swift2FW/build/Swift2FW.build/Debug-iphonesimulator/Swift2FW.build/unextended-module.modulemap:2: umbrella header 'Swift2FW.h' not found :0: error: could not build Objective-C module 'Swift2FW'

Before you ask I've done a clean and deleted my derived data but nothing seems to resolve it except deleting and recreating the workspace and project files.

Any ideas on the source of the error, how to replicate (for a bug report) OR am I being dumb.

EDIT: I've gotten 50 views since this was posted. Sounds like it's a bug I should report. Any ideas on how to do that?

like image 868
richardpj Avatar asked Jun 05 '14 15:06

richardpj


People also ask

What is error handling in Swift?

Error handling is the process of responding to and recovering from error conditions in your app [1]. Once an error occurs, the two things we can do about it is to terminate or recover. Let’s see how we can achieve this with the Swift Combine Framework.

What is the use of umbrella header in Swift?

The umbrella header is actually designated for mixed swift, obj-c framework and its purpose is exposing the APIs to the outer world that your framework has in objective-c or c. That means the headers we put there should be in the public scope.

How to expose Objective-C/C library in Swift code?

(And that is exactly why Allows Non-modular Includes in Framework Modules defaults to NO) In order to expose Objective-C/C library to your framework swift code, we should define a separate swift module for such library. Then a standard swift import YourLegacyLibrary can be used.


1 Answers

When making my own swift framework I got the error "could not build Objective-C module".

I fixed it by going to "Link Binary With Libraries" and adding "UIKit".

like image 114
neoneye Avatar answered Sep 24 '22 19:09

neoneye