I 've made it work with CommonCrypto https://github.com/onmyway133/CommonCrypto.swift but libxml should be the same. Things to keep in mind
module.modulemap
Read http://clang.llvm.org/docs/Modules.html#module-map-language
Create a folder named libxml2
(in my case, it is at the same directory as my project file), then create a module.modulemap
file inside
module libxml2 {
header "/usr/include/libxml2/libxml/tree.h"
export *
}
Here I add just tree.h
, but you can add more for your need
SWIFT_INCLUDE_PATHS
Go to Target Build Settings, add this into Import Paths
${SRCROOT}/libxml2
HEADER_SEARCH_PATHS
Read Why am I getting this "libxml/tree.h file not found" error?
Go to Target Build Settings, add this into Header Search Paths
$(SDKROOT)/usr/include/libxml2
Interesting related posts
- Swift Framework with libxml
- https://spin.atomicobject.com/2015/02/23/c-libraries-swift/
- Importing CommonCrypto in a Swift framework
- https://github.com/onmyway133/Reindeer