Skip to content

molab-itp/WebViewDemo

Repository files navigation

WebViewDemo

  • use UIViewRepresentable to show WKWebView for web content

https://developer.apple.com/documentation/webkit/wkwebview https://developer.apple.com/documentation/webkit/wkwebviewconfiguration https://developer.apple.com/documentation/webkit/wkwebviewconfiguration/usercontentcontroller https://developer.apple.com/documentation/webkit/wkusercontentcontroller


>>     <script src="p5.sound.min.js"></script>
>> in index.html !!@ Fails

>> sketches/shapes_random_pause_v22/index.html
  let url = Bundle.main.url(forResource:urlStr, withExtension: nil);

# --
// https://editor.p5js.org/jht9629-nyu/sketches/2pxhnehBV
// ims04-jht scroll color rate
 // script error on full screen

https://jht9629-nyu.github.io/p5mirror-jht9629-nyu/p5projects/ims04-jht%20scroll%20color%20rate-2pxhnehBV/
>> p5js sketch hosted on github pages OK in WKWebView

// https://editor.p5js.org/jht9629-nyu/sketches/n0LYuXRmX
// shapes random pause v22

>> sketches folder: build runs: apply once to folder

https://claude.ai/chat/e5b00e20-2d54-4f3f-9635-59d81ae0b2f9
select a random color from red, gold and green for text background color

// Claude does not have the ability to run the code it generates yet.
// Claude can make mistakes. Please double-check responses.

>> to get resources into bundle
Targets | Build Phases | Copy Bundle Resoures
+ add sketches

https://developer.apple.com/documentation/webkit/wkwebview/loadfilerequest(_:allowingreadaccessto:)
loadFileRequest(_:allowingReadAccessTo:)
iOS 15.0+

https://developer.apple.com/documentation/webkit/wkwebview/loadfileurl(_:allowingreadaccessto:)
loadFileURL(_:allowingReadAccessTo:)
iOS 9.0+

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages