2017-08-13 181 views
0

SwiftSoup支持Swift 4.0吗?我已经初始化了我的Podfile,并在运行pod安装之前按照SwiftSoup GitHub repo https://github.com/scinfu/SwiftSoup的指示添加了“SwiftSoup”,但我无法将其导入Swift文件。我在XCode中使用.xcworkspace文件,因为SwiftSoup README指示的不是.xcodeproj工作区。SwiftSoup支持Swift 4

Podfile样子:

# Uncomment the next line to define a global platform for your project 
# platform :ios, '9.0' 

target 'httpget' do 
    # Comment the next line if you're not using Swift and don't want to use dynamic frameworks 
    use_frameworks! 

    # Pods for httpget 
    pod "SwiftSoup" 

    target 'httpgetTests' do 
    inherit! :search_paths 
    # Pods for testing 
    end 

    target 'httpgetUITests' do 
    inherit! :search_paths 
    # Pods for testing 
    end 

end 

如果SwiftSoup对雨燕4.0的支持,没有任何人有,我可以使用其它方法吗?我试图解析一个包含HTML的Swift字符串对象,以删除所有脚本标记并提取具有特定类的div标记。

基本上我试图做Python的BeautifulSoup条命令相当于:

classInfo = html.find('div', class_='theClass').get_text()

斯威夫特

+0

from pod 1.5.2版本swift 4支持 – Scinfu

回答

2

只是在开玩笑,我发现问题是我没有编辑我的计划。如果我在Product-> Scheme-> Pod- [projname]下面导入SwiftSoup。但是,在构建我的项目之后,我发现SwiftSoup不支持Swift 4,因为它使用了Swift 4过时的许多函数。