MultiMarkdown-6 icon indicating copy to clipboard operation
MultiMarkdown-6 copied to clipboard

Outdated instructions for embedding libMultiMarkdown in Xcode project

Open nickasd opened this issue 4 years ago • 7 comments

After updating to version 6.6.0, I noticed that the Copy Files build phase doesn't exist anymore, and that #import <libMultiMarkdown/libMultiMarkdown.h> in Bridging-Header.h gives the error 'libMultiMarkdown/libMultiMarkdown.h' file not found. What has to be changed in order to make it work again?

nickasd avatar Feb 11 '21 13:02 nickasd

Hi @nickasd, Would love your input on issue #200 for Swift Package Manger support. It can potentially solve your issue :)

slsrepo avatar Feb 16 '21 00:02 slsrepo

I have not worked on Swift support in years, and every time Swift changes something breaks. @slsrepo has been more active with Swift.

fletcher avatar Feb 16 '21 01:02 fletcher

Thanks, I will have a look at issue #200. (But this issue is about Objective-C, just in case there was a misunderstanding.)

nickasd avatar Feb 18 '21 11:02 nickasd

If there is an issue with Bridging-Header.h then this is a Swift issue, not Objective-C, since that file is only used with Swift projects, correct? Bridging-Header.h isn't even included in the current repo.

fletcher avatar Feb 18 '21 12:02 fletcher

Yeah, sorry for the confusion. What I meant is that before upgrading it used to work: I was able to use the Objective-C symbols inside the Swift project. Now I get the errors listed above.

nickasd avatar Feb 18 '21 12:02 nickasd

The issue is related to Swift, Bridging-Header.h is a file automatically created by Xcode when you want to integrate a C library with Swift.

Since the issue is integrating with Swift, I suggested using the Swift Package instead :)

But without the package, I always had issues when trying to import the headers right from the library.

Sometimes it worked with #import <libMultiMarkdown/libMultiMarkdown.h>, sometimes with #import <libMultiMarkdown/include/libMultiMarkdown/libMultiMarkdown.h>, other times it didn't work no matter what. What I ended up doing (before creating the Swift package, which is what I have been using since) is copying the header files into my project and just using:

#import "libMultiMarkdown6.h"
#import "d_string.h"
#import "token.h"

But the downside of that is that you need to make sure the files in your project are up to date - an outdated header might cause all kind of weird issues that might be hard to debug.

I commented on issue #200 regarding the error you received. Once we get it working for you, that should be the best way to integrate with Swift :)

slsrepo avatar Feb 18 '21 20:02 slsrepo

So does nobody know what to do with that Copy Files phase that is still mentioned in the readme?

nickasd avatar Jan 24 '22 13:01 nickasd