Skip to content

Instantly share code, notes, and snippets.

@AbodiDawoud
Last active December 28, 2025 17:45
Show Gist options
  • Select an option

  • Save AbodiDawoud/ec1b1b181406de077aaa981156d4a3ef to your computer and use it in GitHub Desktop.

Select an option

Save AbodiDawoud/ec1b1b181406de077aaa981156d4a3ef to your computer and use it in GitHub Desktop.
YouTube url schemes for iOS
import SwiftUI
#Preview {
Form {
Section {
Button("Search on YouTube") {
UIApplication.shared.open(URL(string: "youtube://results?search_query=SwiftUI")!)
}
Button("Search on YouTube V2") {
UIApplication.shared.open(URL(string: "youtube:///results?q=Apple Cupertino Park")!)
}
Button("Open YouTube") {
UIApplication.shared.open(URL(string: "youtube://")!)
}
Button("Watch VideoID on YouTube") {
UIApplication.shared.open(URL(string: "youtube://watch?v=mEKQvF4irBM")!)
}
Button("Open YouTube Channel") {
UIApplication.shared.open(URL(string: "youtube://www.youtube.com/user/Expo")!)
}
Button("Open YouTube Subscriptions") {
UIApplication.shared.open(URL(string: "youtube://www.youtube.com/feed/subscriptions")!)
}
Button("Open YouTube Watch Later") {
UIApplication.shared.open(URL(string: "youtube://www.youtube.com/playlist?list=WL")!)
}
Button("Open YouTube History") {
let url = URL(string: "youtube://www.youtube.com/history")!
if UIApplication.shared.canOpenURL(url) {
UIApplication.shared.open(url)
} else {
print("Can't open youtube history URL")
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment