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?
Asked
Active
Viewed 1,495 times
0
-
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 Answers
5
- Add the Objective-C files to your project
- Xcode will ask if you want a Bridging Header, say YES
- Add
#import "TFHpple.h"
to your bridging header - Add
libxml2
to Build Phases > Link binary with library - Add
$(SDKROOT)/usr/include/libxml2
in Header Search Paths - Call your methods in Swift

fpg1503
- 7,492
- 6
- 29
- 49