I have this HTML,
-
You should share the precise errors you received, but I had no problems using TFHpple from Swift. As you do with Objective-C, you have to
make sure you link to the libxml
library in your build phases
add $(SDKROOT)/usr/include/libxml2
to your header search paths in the build settings
See the installation instructions on Wenderlich's How To Parse HTML on iOS or Cocoa with Love's Using libxml2 for XML parsing and XPath queries in Cocoa.
When you add the TFHpple source to your project, you should be prompted to create a bridging header. Do so, and then add #import "TFHpple"
to it. For more information, see the Importing Objective-C into Swift section of the Swift and Objective-C in the Same Project chapter of the Using Swift with Cocoa and Objective-C guide.
Once you do that, you should be able to use TFHpple without incident from Swift.
讨论(0)