4 ms·
This speaks to me. I’m not deeply involved in the iOS development world but I do a lot of webview-adjacent stuff so I keep a close eye on the WKWebView document
by afavour 5y ago
This speaks to me. I’m not deeply involved in the iOS development world but I do a lot of webview-adjacent stuff so I keep a close eye on the WKWebView documentation.
It’s a mess. Case in point: introduced in the new beta: loadSimulatedRequest:
https://developer.apple.com/documentation/webkit/wkwebview/3763094-loadsimulatedrequest?changes=latest_minor https://developer.apple.com/documentation/webkit/wkwebview/3...
What does it do? Don’t know. I can make a few informed guesses from the name but I’m not sure if it’s maybe a performance measurement tool, or just a way of loading faked data. There is no documentation. To the best of my knowledge it isn’t covered in any talks either.
- Fordec 5y agoWow, I think that's my new go to example for bad documentation. That may actually be worse than no documentation because you wasted time looking for what is in essence a mere repeating of the function call and nothing else.
- threeseed 5y agoNot sure why. It's nothing more than an autogenerated documentation page for a method that hasn't yet been documented. And it's specifically listed as being recently added so that explains why. I find pages like this all the time in the Java, Rust, Python etc ecosystems. At least with Objective-C/Swift the method signatures are consistently well named.
- tayistay 5y agoSometimes you have to look in the headers. I don't know why it doesn't get parsed into the docs. Here's the documentation for loadSimulatedRequest: /*! @abstract Sets the webpage contents from the passed data as if it was the response to the supplied request. The request is never actually sent to the supplied URL, though loads of resources defined in the NSData object would be performed. @param request The request specifying the base URL and other loading details to be used while interpreting the supplied data object. @param response A response that is used to interpret the supplied data object. @param data The data to use as the contents of the webpage. @result A new navigation. */
- afavour 5y agoThat’s very useful information that would be very useful i the docs! Thank you. I’m a little confused as to how it differs from the existing method for loading data: https://developer.apple.com/documentation/webkit/wkwebview/1415011-load https://developer.apple.com/documentation/webkit/wkwebview/1... but I suppose it allows for more customisability. Marking the existing one as deprecated would go a long way to solving the mystery. Assuming that’s even correct! This is where documentation beyond literally only detailing what the API does would be great.
- code_duck 5y agoAs I read it, the simulated response call doesn’t actually hit the URL, it just sets up the object like it’s going to then loads the data you supplied. Not sure when that’s useful since I’m not an iOS programmer.
- aYsY4dDQ2NrcNzA 5y agoUnit testing?
- afavour 5y agoMore likely for offline caching of web content. But unit tests too!
- lilyball 5y agoNew APIs introduced in betas often don’t have documentation until later. When working with beta APIs, read the header.
- seanalltogether 5y agoMy latest one was the documentation for slicing up strings. All the example code for string.prefix() string.suffix() string.subscript() has code examples using arrays. https://developer.apple.com/documentation/swift/string/2894830-prefix https://developer.apple.com/documentation/swift/string/28948...
- saagarjha 5y agoThose are automatically inherited docs (from Collection?), I think Xcode will actually tells you this but for some reason the website isn't.