ϦϑΝϨϯε͔ΒಡΈղ͘WebKit.framework@yashigani Cocoaษڧձؔ #56
View Slide
@yashigani
–Mattt Thompson“UIWebView is dead. Long liveWKWebView.”
WKWebView is Կʁ
WKWebViewͷਖ਼ମ• Safari/Mobile Safariͱಉ͡ͷ͕͑Δ• ϞμϯͳΠϯλʔϑΣʔε• WebKit 2 APIϕʔε• ࣮UIWebViewWebViewҧ͏API
WebKit 2 API• ϚϧνϓϩηεʹରԠͨ͠API• WebKit 1ͱඇޓ• Safari 5.1(07/2011)~
࣮͜ͳ͍ͩൃදͨ͠• @kyoto.ͳΜ͔• WebKit 2 APICϕʔεͰʙͬͯͨ͠• ՈؼͬͯϦϙδτϦݟͨΒͦΜͳ͜ͱͳͯ݁͘ߏͪΌΜͱͯͨ͠• #expectWWDC
ΊͰ͍ͨʂ
WKWebView• iOS/OS XͰڞ௨• ϞμϯͳΠϯλʔϑΣʔε• property/delegate• Ϛϧνϓϩηε
ߏ• WKWebView• WKUIDelegate• WKNavigationDelegate• WKWebViewConfiguration• WKPreferences• WKUserContentController
WKWebView• Built-in Gesture• KVO compliant• title/URL/loading/estimatedProgress…• backForwardList• WKUIDelegate/WKNavigationDelegate
WKUIDelegate• alert()ͷॲཧΛࣗલͰ• ࣗͰॲཧͯ͠ɼcompletionHandlerΛݺͿ
WKNavigationDelegate• shouldStart…/didFinish…• UIDelegateͱಉ༷ʹdecisionHandlerͰॲཧ• ϩʔυͷਐḿΛࡉ͔͘औಘͰ͖Δ
WKWebViewConfiguration• WKPreferences/WKProcessPool/WKUserContentController• WKWebViewΛॳظԽ͢Δͱ͖ʹ͢• ෳWKWebViewΛ࡞Δͱ͖ʹڞ༗Ͱ͖Δ
WKPreferences• JavaScriptͷΦϯΦϑ• ϑΥϯταΠζ• ಈը࠶ੜΛΠϯϥΠϯͰ• ઃఆUser Defaultsʹอଘ͞ΕΔ
WKUserContentController• ϩʔυ͢ΔUser ScriptͷՃ/আ• User ScriptͷHandlerΛొ• User Script͔ΒϝοηʔδΛૹΕΔ
σϝϦοτ
stringByEvaluatingJavaScriptFromString:͕ແ͍
͡Ό͋Ͳ͏͠Ζͱ• User ScriptͰͳΜͱ͔͠Ζͱ͍͏͜ͱʁ• Easy app-webpage communication• ͪΖΜΦʔϓϯͳ࣮ʹ͋Δ• evaluateJavaSctipt:completionHandler:• ৭ʑࢼ͚ͨ͠Ͳ… #͍ͯͩ͘͠͞
OS X͔Β͢Δͱ…• ΊͬͪΌऑମԽ• WebViewʹ͋Δdelegateͬͱ͋Δ• WebFrameʹΞΫηεͰ͖ͳ͍͠…• ͪΖΜJSContext͑ͳ͍
ٙ• લճͷWWDCͰJavaScriptCore.frameworkΛ։์ͨ͠ҙਤ͕Θ͔Βͳ͍• ಛʹ࠷ۙWebKitͷJSEngine͍͢͝վྑ͞Ε͍ͯΔ• ϑΟʔυόοΫ࣍ୈͰͬͱ։์͞ΕΔՄೳੑ͕ʁ
·ͱΊ• UIWebView is dead. Long live WKWebView.• Ϛϧνϓϩηε+Ϟμϯ API• ࠓͷͱ͜Ζظ΄ͲͰͳ͍(ͱࢥ͏)• ͨͩ͠ྗΛೖΕ͍ͯΔͷ͔֬• ظͯ͠ΔਓBug Reportʹཁग़ͦ͏ʂ
ؔ࿈• http://www.webkit.org• https://github.com/webkit/webkit• Introducing the Modern WebKit API• http://nshipster.com/ios8/
Thank you!