mkoehnke / WKZombie

WKZombie is a Swift framework for iOS/OSX to navigate within websites and collect data without the need of User Interface or API, also known as Headless browser. It can be used to run automated tests / snapshots and manipulate websites using Javascript.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

open method not visible when using WKZombie in Objective C project

billylo1 opened this issue · comments

Hi, after adding WKZombie to my podfile and adding @import WKZombie;, I can invoke some methods on the WKZombie.shareInstance, e.g. dump, setTimeoutSeconds, but the essential open method is not visible for some reasons.

Would you have any hints on how to solve this?

thanks.

Hi @billylo1 Thanks for reporting this. You're right, there seems to be an issue with the extensions not being visible in Objective C code. I'll look into it.

Thanks! Looking forward to it!

Sorry for the confusion! I forgot that Swift generic functions are not supported by Objective-C. So this is the correct behaviour. However, you should be able to add a Swift file to your Objective-C project (Mix and Match) and use WKZombie in there. Hope that helps!

I did try that. Importing the WKZombie-swift.h to make WKZombie visible to the objective C code. But I can't find a way to invoke "open". Are you able to make it work in Xcode?

Just add a Swift file (e.g. Test.swift) to your project and simply add "import WKZombie". Create a class/function, do all the headless browsing there and hand the result back to your Objective-C code.