How to play YouTube video in iOS with swift 5

How to play YouTube video in iOS with swift 5
May 1, 2020 No Comments Development,iOS Development Pushpendra Kumar

In this tutorial, I have explained to you that, how you can play YouTube videos with the help of YouTube video id in iOS. So here we will start with the basic example. In this example, I will show the complete result of how we can achieve this task. And also I will tell what are the techniques you need to keep in mind while you are working for the YouTube video player. And this development we will do in swift 5 programming language. So follows the complete video. And if you like this blog please comment below. 

Play YouTube video in iOS with swift 5

Note you can find the YouTube video also of this task. Well below is the steps which you have to follow. While you want Play Youtube video in iOS device with swift 5 programming language.

Firstly you have add the ‘YoutubePlayer-in-WKWebView’ as pod library. Which is mention into YouTube video.

After that, You have to write the following code as mention below!

import UIKit
import YoutubePlayer_in_WKWebView

class ViewController: UIViewController {
    @IBOutlet weak var player: WKYTPlayerView!
    override func viewDidLoad() {
        player.load(withVideoId: "6smmGjep75s")
        player.delegate = self
    override func viewDidDisappear(_ animated: Bool) {

extension ViewController : WKYTPlayerViewDelegate {
    func playerViewDidBecomeReady(_ playerView: WKYTPlayerView) {

Wonderful..😎😎😊 You have done the great job. Now you can Build and run ▶️ your Xcode project and you will see the desire output. Bu if still you have any doubt then you can visit on the Youtube video and there you can check the complete process.  And if you understand the complete code then please subscribe to my YouTube channel for the latest updates for the swift code and trick. 

And moreover you may like the following videos for boosting your skills.

About The Author
Pushpendra Kumar I am passionate about mobile application development and professional developer at Colour Moon Technologies Pvt Ltd ( This website I have made so that I can meet with new challenges and can share here.

Leave a reply

Your email address will not be published. Required fields are marked *