Upgrade to Pro — share decks privately, control downloads, hide ads and more …

What's new WebKit.framework

What's new WebKit.framework

yashigani

June 21, 2014
Tweet

More Decks by yashigani

Other Decks in Technology

Transcript

  1. ϦϑΝϨϯε͔ΒಡΈղ͘
    WebKit.framework
    @yashigani

    Cocoaษڧձؔ੢ #56

    View full-size slide

  2. –Mattt Thompson
    “UIWebView is dead. Long live
    WKWebView.”

    View full-size slide

  3. WKWebView is Կʁ

    View full-size slide

  4. WKWebViewͷਖ਼ମ
    • Safari/Mobile Safariͱಉ͡΋ͷ͕࢖͑Δ
    • ϞμϯͳΠϯλʔϑΣʔε
    • WebKit 2 APIϕʔε
    • ࣮͸UIWebView΍WebView͸ҧ͏API

    View full-size slide

  5. WebKit 2 API
    • ϚϧνϓϩηεʹରԠͨ͠API
    • WebKit 1ͱ͸ඇޓ׵
    • Safari 5.1(07/2011)~

    View full-size slide

  6. ࣮͸͜ͳ͍ͩൃදͨ͠
    • @kyoto.ͳΜ͔
    • WebKit 2 API͸CϕʔεͰʙͬͯ࿩΋ͨ͠
    • ՈؼͬͯϦϙδτϦݟͨΒͦΜͳ͜ͱͳͯ͘
    ݁ߏͪΌΜͱͯͨ͠
    • #expectWWDC

    View full-size slide

  7. WKWebView
    • iOS/OS XͰڞ௨
    • ϞμϯͳΠϯλʔϑΣʔε
    • property/delegate
    • Ϛϧνϓϩηε

    View full-size slide

  8. ߏ੒
    • WKWebView
    • WKUIDelegate
    • WKNavigationDelegate
    • WKWebViewConfiguration
    • WKPreferences
    • WKUserContentController

    View full-size slide

  9. WKWebView
    • Built-in Gesture
    • KVO compliant
    • title/URL/loading/estimatedProgress…
    • backForwardList
    • WKUIDelegate/WKNavigationDelegate

    View full-size slide

  10. WKUIDelegate
    • alert()ͷॲཧΛࣗલͰ
    • ࣗ෼Ͱॲཧͯ͠ɼcompletionHandlerΛݺͿ

    View full-size slide

  11. WKNavigationDelegate
    • shouldStart…/didFinish…
    • UIDelegateͱಉ༷ʹdecisionHandlerͰॲཧ
    • ϩʔυͷਐḿΛࡉ͔͘औಘͰ͖Δ

    View full-size slide

  12. WKWebViewConfiguration
    • WKPreferences/WKProcessPool/
    WKUserContentController
    • WKWebViewΛॳظԽ͢Δͱ͖ʹ౉͢
    • ෳ਺WKWebViewΛ࡞Δͱ͖ʹڞ༗Ͱ͖Δ

    View full-size slide

  13. WKPreferences
    • JavaScriptͷΦϯΦϑ
    • ϑΥϯταΠζ
    • ಈը࠶ੜΛΠϯϥΠϯͰ
    • ઃఆ͸User Defaultsʹอଘ͞ΕΔ

    View full-size slide

  14. WKUserContentController
    • ϩʔυ͢ΔUser Scriptͷ௥Ճ/࡟আ
    • User ScriptͷHandlerΛొ࿥
    • User Script͔ΒϝοηʔδΛૹΕΔ

    View full-size slide

  15. stringByEvaluatingJavaScriptFromString:
    ͕ແ͍

    View full-size slide

  16. ͡Ό͋Ͳ͏͠Ζͱ
    • User ScriptͰͳΜͱ͔͠Ζͱ͍͏͜ͱʁ
    • Easy app-webpage communication
    • ΋ͪΖΜΦʔϓϯͳ࣮૷ʹ͸͋Δ
    • evaluateJavaSctipt:completionHandler:
    • ৭ʑࢼ͚ͨ͠Ͳ… #࡯͍ͯͩ͘͠͞

    View full-size slide

  17. OS X͔Β͢Δͱ…
    • ΊͬͪΌऑମԽ
    • WebViewʹ͋Δdelegate͸΋ͬͱ͋Δ
    • WebFrameʹ΋ΞΫηεͰ͖ͳ͍͠…
    • ΋ͪΖΜJSContext΋࢖͑ͳ͍

    View full-size slide

  18. ٙ໰
    • લճͷWWDCͰJavaScriptCore.frameworkΛ
    ։์ͨ͠ҙਤ͕Θ͔Βͳ͍
    • ಛʹ࠷ۙ͸WebKitͷJSEngine͸͍͢͝վྑ
    ͞Ε͍ͯΔ
    • ϑΟʔυόοΫ࣍ୈͰ͸΋ͬͱ։์͞ΕΔՄ
    ೳੑ͕ʁ

    View full-size slide

  19. ·ͱΊ
    • UIWebView is dead. Long live WKWebView.
    • Ϛϧνϓϩηε+Ϟμϯ API
    • ࠓͷͱ͜Ζظ଴΄ͲͰ͸ͳ͍(ͱࢥ͏)
    • ͨͩ͠ྗΛೖΕ͍ͯΔͷ͸͔֬
    • ظ଴ͯ͠Δਓ͸Bug Reportʹཁ๬ग़ͦ͏ʂ

    View full-size slide

  20. ؔ࿈
    • http://www.webkit.org
    • https://github.com/webkit/webkit
    • Introducing the Modern WebKit API
    • http://nshipster.com/ios8/

    View full-size slide