Posts

Showing posts from November, 2017

Parse JSON objects in Swift from WKWebView

Upto this point, I had only worked with the UIWebView in iOS, even though I had heard/read about the new WKWebView . I had only read good things about it but given the limited resources at my startup, working with WKWebView was a lower priority. A few weeks ago, the time was right for me to have a more in-depth look at the WKWebView and while learning more about it I realised something. I realised that while there are a ton of useful tutorials out there, almost none of them covered it with the depth or all the use cases that I was after. One example of missing information or a use case is, if we receive a json object from the webview, how do we parse it in Swift? In this post I will be talking about how to parse json data in Swift sent from web content hosted in a WKWebView of an iOS app. Background As seen from HTMLStarterAppWithSwift , my interest in the webview is not for showing content hosted in a website but more towards working with content hosted locally i.e. a nati...