2017-08-13 90 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過時的許多函數。