0

I'm relatively new to programming and I have spent hours on trying to understand how to import TFHpple library (or any Objective C library) into my Swift code. I have read the documentations but I still don't really understand it can anyone point me in the right direction?

YellowPillow
  • 4,100
  • 6
  • 31
  • 57
  • possible duplicate of [How to call Objective C code from Swift](http://stackoverflow.com/questions/24002369/how-to-call-objective-c-code-from-swift) – fpg1503 Feb 02 '15 at 02:06
  • Possible duplicate of http://stackoverflow.com/questions/24237238/compilation-error-using-tfhpple-framework-from-swift/ – Rob Feb 02 '15 at 02:42

1 Answers1

5
  1. Add the Objective-C files to your project
  2. Xcode will ask if you want a Bridging Header, say YES
  3. Add #import "TFHpple.h" to your bridging header
  4. Add libxml2 to Build Phases > Link binary with library
  5. Add $(SDKROOT)/usr/include/libxml2 in Header Search Paths
  6. Call your methods in Swift
fpg1503
  • 7,492
  • 6
  • 29
  • 49