This page provides comprehensive documentation for the YoutubePlayer-in-WKWebView library, which allows embedding YouTube videos in the WKWebView component.


To install YoutubePlayer-in-WKWebView, follow these steps:

  1. Open your project in Xcode
  2. Navigate to the folder where you want to install the library
  3. Clone the repository using the command: git clone
  4. Open the cloned folder
  5. Add the YoutubePlayer-in-WKWebView.xcodeproj file to your Xcode project
  6. In Xcode’s General settings, add YoutubePlayer-in-WKWebView.framework to Embedded Binaries
  7. Import the library in your code using import YoutubePlayer_in_WKWebView


To use YoutubePlayer-in-WKWebView, follow these steps:

  1. Create a new instance of WKWebView in your view controller
  2. Import the library using import YoutubePlayer_in_WKWebView
  3. Call the loadVideo method of the WKWebView instance, providing the YouTube video ID
  4. Play and control the video using the provided methods and properties, such as playVideo, pauseVideo, mute, etc.


Here’s an example of how to use YoutubePlayer-in-WKWebView in your iOS app:

import UIKit
import WebKit
import YoutubePlayer_in_WKWebView

class ViewController: UIViewController {
    var webView: WKWebView!

    override func viewDidLoad() {
        // Create a new instance of WKWebView
        webView = WKWebView(frame: .zero)
        // Add it to your view hierarchy and set up constraints
        // Load a YouTube video with the video ID
        webView.loadVideo(videoID: "VIDEO_ID")
        // Additional video control and customization
        // ...


  • iOS 11.0+
  • Swift 5.0+
  • Xcode 11+
  • Webkit framework


The YoutubePlayer-in-WKWebView library is released under the MIT License.


This documentation provides a comprehensive guide to using the YoutubePlayer-in-WKWebView library. Follow the installation and usage instructions to easily embed and control YouTube videos in your iOS app using WKWebView.