Swift Playgrounds: Rendering Local html file in WebKit works on simulator but not on deviceDetect if app is being built for device or simulator in SwiftiOS Webkit not working on device, but works on simulator at swiftRead file in swift, iOS playgroundSwift Playground - Files are not readableWhy is my Printable implementation not working in Swift playground?Xcode playgrounds can't access swift files in Sources folderHow to detect tableView cell touched or clicked in swiftIs it possible to simulate device orientation in a playground?How do Swift Playgrounds Work?Swift Error - Use of undeclared type 'cell' - Collection View

Can a UK national work as a paid shop assistant in the USA?

Why does the Starter Set wizard have six spells in their spellbook?

Python program for fibonacci sequence using a recursive function

Why did Jon Snow do this immoral act if he is so honorable?

Is it legal to have an abortion in another state or abroad?

Are there any German nonsense poems (Jabberwocky)?

Why was this character made Grand Maester?

What are these clip-like things?

Cardio work for Muay Thai fighters

Is "vegetable base" a common term in English?

How to teach an undergraduate course without having taken that course formally before?

Second map without labels

Why did other houses not demand this?

Burned out due to current job, Can I take a week of vacation between jobs?

Are cells guaranteed to get at least one mitochondrion when they divide?

If I arrive in the UK, and then head to mainland Europe, does my Schengen visa 90 day limit start when I arrived in the UK, or mainland Europe?

Possibility of faking someone's public key

Freedom of Speech and Assembly in China

How did the Unsullied find out that Jon did this?

Is there a simple example that empirical evidence is misleading?

Shorten or merge multiple lines of `&> /dev/null &`

Heat lost in ideal capacitor charging

shell script is not executed after adding it as a crontab job

Why sampling a periodic signal doesn't yield a periodic discrete signal?



Swift Playgrounds: Rendering Local html file in WebKit works on simulator but not on device


Detect if app is being built for device or simulator in SwiftiOS Webkit not working on device, but works on simulator at swiftRead file in swift, iOS playgroundSwift Playground - Files are not readableWhy is my Printable implementation not working in Swift playground?Xcode playgrounds can't access swift files in Sources folderHow to detect tableView cell touched or clicked in swiftIs it possible to simulate device orientation in a playground?How do Swift Playgrounds Work?Swift Error - Use of undeclared type 'cell' - Collection View






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I'm trying to render a WebKit view using a local HTML file i have on my playground but it renders it on the simulator but it doesn't on the playground.



My code looks something like this:



import UIKit
import Foundation
import PlaygroundSupport
import WebKit

public class Plastic : UIViewController, WKUIDelegate

var webView: WKWebView!

public override func loadView()
let webConfiguration = WKWebViewConfiguration()
webView = WKWebView(frame: .zero, configuration: webConfiguration)
webView.uiDelegate = self
view = webView


public override func viewDidLoad()
super.viewDidLoad()

let url = Bundle.main.url(forResource: "plastic", withExtension: "html")!
webView.loadFileURL(url, allowingReadAccessTo: url)
let myRequest = URLRequest(url: url)
webView.load(myRequest)


@objc func notification()
PlaygroundPage.current.liveView = Banana()





Can this be a bug in playgrounds for local HTML files not to be rendered? This is odd behaviour for me and I don't know how to solve it.










share|improve this question




























    0















    I'm trying to render a WebKit view using a local HTML file i have on my playground but it renders it on the simulator but it doesn't on the playground.



    My code looks something like this:



    import UIKit
    import Foundation
    import PlaygroundSupport
    import WebKit

    public class Plastic : UIViewController, WKUIDelegate

    var webView: WKWebView!

    public override func loadView()
    let webConfiguration = WKWebViewConfiguration()
    webView = WKWebView(frame: .zero, configuration: webConfiguration)
    webView.uiDelegate = self
    view = webView


    public override func viewDidLoad()
    super.viewDidLoad()

    let url = Bundle.main.url(forResource: "plastic", withExtension: "html")!
    webView.loadFileURL(url, allowingReadAccessTo: url)
    let myRequest = URLRequest(url: url)
    webView.load(myRequest)


    @objc func notification()
    PlaygroundPage.current.liveView = Banana()





    Can this be a bug in playgrounds for local HTML files not to be rendered? This is odd behaviour for me and I don't know how to solve it.










    share|improve this question
























      0












      0








      0








      I'm trying to render a WebKit view using a local HTML file i have on my playground but it renders it on the simulator but it doesn't on the playground.



      My code looks something like this:



      import UIKit
      import Foundation
      import PlaygroundSupport
      import WebKit

      public class Plastic : UIViewController, WKUIDelegate

      var webView: WKWebView!

      public override func loadView()
      let webConfiguration = WKWebViewConfiguration()
      webView = WKWebView(frame: .zero, configuration: webConfiguration)
      webView.uiDelegate = self
      view = webView


      public override func viewDidLoad()
      super.viewDidLoad()

      let url = Bundle.main.url(forResource: "plastic", withExtension: "html")!
      webView.loadFileURL(url, allowingReadAccessTo: url)
      let myRequest = URLRequest(url: url)
      webView.load(myRequest)


      @objc func notification()
      PlaygroundPage.current.liveView = Banana()





      Can this be a bug in playgrounds for local HTML files not to be rendered? This is odd behaviour for me and I don't know how to solve it.










      share|improve this question














      I'm trying to render a WebKit view using a local HTML file i have on my playground but it renders it on the simulator but it doesn't on the playground.



      My code looks something like this:



      import UIKit
      import Foundation
      import PlaygroundSupport
      import WebKit

      public class Plastic : UIViewController, WKUIDelegate

      var webView: WKWebView!

      public override func loadView()
      let webConfiguration = WKWebViewConfiguration()
      webView = WKWebView(frame: .zero, configuration: webConfiguration)
      webView.uiDelegate = self
      view = webView


      public override func viewDidLoad()
      super.viewDidLoad()

      let url = Bundle.main.url(forResource: "plastic", withExtension: "html")!
      webView.loadFileURL(url, allowingReadAccessTo: url)
      let myRequest = URLRequest(url: url)
      webView.load(myRequest)


      @objc func notification()
      PlaygroundPage.current.liveView = Banana()





      Can this be a bug in playgrounds for local HTML files not to be rendered? This is odd behaviour for me and I don't know how to solve it.







      swift webkit swift-playground






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 23 at 23:14









      MatejMeckaMatejMecka

      1,11411825




      1,11411825






















          1 Answer
          1






          active

          oldest

          votes


















          0














          The Art of the Bodge. This is one way i fixed it to work on a device. Not the best way but it does the job in the short time I had.



          if let url = Bundle.main.path(forResource: "pla", ofType: "html")
          do
          let contents = try String(contentsOfFile: url)
          webView.loadHTMLString(contents, baseURL: nil)
          catch
          return








          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55319240%2fswift-playgrounds-rendering-local-html-file-in-webkit-works-on-simulator-but-no%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            The Art of the Bodge. This is one way i fixed it to work on a device. Not the best way but it does the job in the short time I had.



            if let url = Bundle.main.path(forResource: "pla", ofType: "html")
            do
            let contents = try String(contentsOfFile: url)
            webView.loadHTMLString(contents, baseURL: nil)
            catch
            return








            share|improve this answer



























              0














              The Art of the Bodge. This is one way i fixed it to work on a device. Not the best way but it does the job in the short time I had.



              if let url = Bundle.main.path(forResource: "pla", ofType: "html")
              do
              let contents = try String(contentsOfFile: url)
              webView.loadHTMLString(contents, baseURL: nil)
              catch
              return








              share|improve this answer

























                0












                0








                0







                The Art of the Bodge. This is one way i fixed it to work on a device. Not the best way but it does the job in the short time I had.



                if let url = Bundle.main.path(forResource: "pla", ofType: "html")
                do
                let contents = try String(contentsOfFile: url)
                webView.loadHTMLString(contents, baseURL: nil)
                catch
                return








                share|improve this answer













                The Art of the Bodge. This is one way i fixed it to work on a device. Not the best way but it does the job in the short time I had.



                if let url = Bundle.main.path(forResource: "pla", ofType: "html")
                do
                let contents = try String(contentsOfFile: url)
                webView.loadHTMLString(contents, baseURL: nil)
                catch
                return









                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 24 at 9:25









                MatejMeckaMatejMecka

                1,11411825




                1,11411825





























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55319240%2fswift-playgrounds-rendering-local-html-file-in-webkit-works-on-simulator-but-no%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                    용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

                    155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해