I've been trying to XLForms in Swift using a bridge header as they suggest.
I've loaded the XLForms Pod and added the bridge file and referenced it in Swift Compiler. The Bridge file references includes #import <XLForm/XLForm.h>.
However, when I try and compile my project I get
Use of undeclared type 'XLFormViewController'
I assume that means it Swift hasn't got access to the library.
I've tried different versions and attempting the setup again, but I can't seem to get it to find it. If I change #import <XLForm/XLForm.h> to #import <XLForm.h> Xcode warns me that it can't find the file, so I know that Xcode is finding it with #import <XLForm/XLForm.h> .. just not allowing me to use it.
Any suggestions?
EDIT: I've tried including another library and I'm experiencing the same issue. Are there any other steps to using the Bridge Header?
Using
import XLForm
Resolved the problem.
Related
There's and old objective-c class that I use to create side menus. Now I 'm using a better swift class to do so. I've removed #include "SWRevealViewController.h" from my bridge file and removed the .h and .m files from project files. I also check for any references to the files in projects build settings and removed them too.
But after that, Xcode started to give random errors like Use of undeclared type 'UICollectionViewCell' and Use of undeclared type 'CGFloat'; did you mean to use 'CGFloat'?
Am I missing some point?
App is coding with Swift, SQLCipher installed and had tried to compile the app without using database, it worked well, but when I tried to use sqlite3_key, it gives an error: Use of unresolved identifier 'sqlite3_key'.
I have defined -DSQLITE_HAS_CODEC in CFLAGS and added #import in bridgeHeader.h
Can anyone help to solve this error?
Thanks.
In your bridging header you need to add this before importing sqlite3.h:
#define SQLITE_HAS_CODEC 1
Source: https://discuss.zetetic.net/t/use-of-unresolved-identifier-sqlite3-key/1305/10
Make sure you have added in Build settings objective-C Bridging Header with name "YourProjectName-Bridging-Header.h"
Although it's a quite old question, there are still someone will encounter the same issue.
The problem is with the SQLCipher document,
In the bridging header add #import <sqlite3.h>.
This is wrong statement actually, you should add #import "sqlite3.h" instead. Because XCode also come with a sqlite3 module by default, if you import it with diamond bracket, it will use the default one from XCode. The default one does not have ciphering feature, that's why you cannot use sqlite3_key() and related functions.
I'm trying to use the XlsxReaderWriter library from Github - https://github.com/renebigot/XlsxReaderWriter
I have followed the steps and now this is my project hierarchy - http://postimg.org/image/4daa89bo7/
I have added the project as a sub project and added it in the target dependencies and added the libXlsxReaderWriter.a to the binary like this - http://postimg.org/image/3l2z7uxyl/
The problem is that I can't use the library and that the libXlsxReaderWriter library is marked in red.
How can I set up the XlsxReaderWriter library correctly?
I've just committed some code plus a Swift bridge header file. You should use it as your bridge header file or #import it from your current one.
Let me know if everything run fine. I'm still using Obj-C (shame on me!), so I've never tested it with Swift.
Cheers
First I want to note, I've read this and have used it before and my question is different:
How to call Objective-C code from Swift
I'm trying to use this library in Swift.
This library uses OCMock and when I try to compile, I get 'OCMock/OCMock.h' file not found at the line #import <OCMock/OCMock.h>. Here's how I normally fix it, but this time, it's not working.
Just like every other Obj-C library in Swift, I added it to my bridge header, which I already had made and am using for others:
#import "JSQMessages.h"
#import "JSQMessageData.h"
I then added $(PROJECT_DIR) to my Header Search Paths.
Here is the file structure.
From the project directory, it should look for OCMock/OCMock.h, and it is there, as seen in screenshot. So why isn't it working?
I just created a fresh swift iOS project, add JSQMessage using CocoaPod(http://cocoapods.org). No error. try following:
1. Create a new project
2. Create a podfile and add
pod 'JSQMessagesViewController'
3. Create a bridge header and add
#import <JSQMessagesViewController/JSQMessages.h> // import all the things
3. Run
pod install
4. Open project.xcworkspace and build it
I'm attempting to getting the Amazon iOS SDK integrated into my application and using the cocoapod to install it.
However, it won't compile, I'm getting an error inside of AmazonS3Client.h that says
'AWKRuntime/AmazonWebServiceClient.h' file not found
but it is clearly there in the Pod when I search for it.
Anyone else had this issue?
Note: This answer refers to a now deprecated version of the AWS SDK for iOS.
I ran into the same problem when migrating a project to CocoaPods. Without modifying any of the AWS header files, I was able to avoid by changing my header import lines from:
#import <AWSS3/AWSS3.h>
#import <AWSSNS/AWSSNS.h>
to:
#import <AmazonS3Client.h>
#import <AmazonSNSClient.h>
This works because all that AWSS3.h does is #define AWS_MULTI_FRAMEWORK and then #import "AmazonSNSClient.h", and AWS_MULTI_FRAMEWORK is responsible for the other header files expecting a different directory structure than what CocoaPods sets up.
To find out what file names you need to include, just look inside the AWS*.h file you were importing and then import the files named inside directly.
When using the cocoapod for AWS it has this in the separate framework headers:
#ifndef AWS_MULTI_FRAMEWORK
#define AWS_MULTI_FRAMEWORK
#endif
That makes it look to other frameworks instead of the relative path for the headers for shared frameworks.
If you comment those lines out, it will work.