SwiftUI WebView Tutorial

Поділитися
Вставка
  • Опубліковано 22 сер 2024
  • Learn how to use a WebView in your SwiftUI project to display a webpage!
    In this SwiftUI WebView tutorial, we’ll cover:
    A basic usage example
    How to use UIKit components in a SwiftUI project
    How to dynamically load a url
    👋 Our "Launch Your First App" program will help you build up your iOS skills to publish your very own feature rich app even if you’re a beginner starting from scratch. cwc.to/youtube...
    Download sample code for all SwiftUI components here:
    cwc.to/swiftui...
    Article version of this tutorial:
    codewithchris....
    For tutorials of other SwiftUI components, check out our playlist here:
    • SwiftUI Components

КОМЕНТАРІ • 19

  • @CodeWithChris
    @CodeWithChris  2 місяці тому

    👋 Our "Launch Your First App" program will help you build up your iOS skills to publish your very own feature rich app even if you’re a beginner starting from scratch. cwc.to/youtubeoffer

  • @pasta0328
    @pasta0328 2 місяці тому +3

    Got excited for a moment there

    • @CodeWithChris
      @CodeWithChris  2 місяці тому +1

      Ah, sorry i know what you mean but everyone searches for "SwiftUI WebView" and so that's what I have to optimize the title for. I hope they make it easier for us in the future!

    • @pasta0328
      @pasta0328 2 місяці тому +1

      Oh totally all good on the title! I hope so, too!

  • @jyunderwood
    @jyunderwood 2 місяці тому +3

    This is a good start, but none of the JavaScript UI will work like alerts and confirmations. If you need support for these, the WKUIDelegate protocol will need to be implemented.

    • @CodeWithChris
      @CodeWithChris  2 місяці тому

      Ah! Thank you for that reminder. I didn't know that!

  • @ericdraven7857
    @ericdraven7857 2 місяці тому +1

    Hopefully we get some new SwiftUI features come WWDC.

  • @nekbeth
    @nekbeth 17 днів тому

    App crashes, asks for entitlements. Any clue? thanks

  • @immanuelkolwin
    @immanuelkolwin 2 місяці тому +1

    Can I upload webview app in app store?

    • @CodeWithChris
      @CodeWithChris  2 місяці тому

      Maybe someone else with that experience can comment but my feeling is if the webview is a significant part of the app, then it won't pass.

    • @immanuelkolwin
      @immanuelkolwin 2 місяці тому

      @@CodeWithChris okay

    • @CodeWithChris
      @CodeWithChris  2 місяці тому

      I use the platform called Plutio to run my photography business. It handles my invoices, etc. The macOS and iOS app is just the web app inside some sort of WebView window... so I wouldn't be surprised this is what they did.
      @AdrienVillez

    • @immanuelkolwin
      @immanuelkolwin 2 місяці тому

      @@CodeWithChris thank you for give me a clarification brother

  • @pmanolak
    @pmanolak 2 місяці тому

    Can this also used to get data from API which returns a json?

    • @CodeWithChris
      @CodeWithChris  2 місяці тому +1

      No, this only shows how to add a webview to a SwiftUI view and load a web page. You’ll need to use `URLSession` instead. - Iñaki

    • @pmanolak
      @pmanolak 2 місяці тому

      @@CodeWithChris Thanks Chris! I am trying to find an easy way to use some existed APIs built in PHP (to get data from mysql DBs), but as I beginner in swift, I am still learning the basics! :-)

  • @Rishi-sv5ns
    @Rishi-sv5ns 2 місяці тому

    How to use WKWebView Delegate methods?

    • @CodeWithChris
      @CodeWithChris  2 місяці тому +1

      Hi there, we've got a community of learners over at cwc.to/codecrew. I highly recommend joining and reaching out for assistance, especially for any concepts you're finding challenging to grasp. - Iñaki