View in English

  • Apple Developer
    • Get Started

    Explore Get Started

    • Overview
    • Learn
    • Apple Developer Program

    Stay Updated

    • Latest News
    • Hello Developer
    • Platforms

    Explore Platforms

    • Apple Platforms
    • iOS
    • iPadOS
    • macOS
    • tvOS
    • visionOS
    • watchOS
    • App Store

    Featured

    • Design
    • Distribution
    • Games
    • Accessories
    • Web
    • Home
    • CarPlay
    • Technologies

    Explore Technologies

    • Overview
    • Xcode
    • Swift
    • SwiftUI

    Featured

    • Accessibility
    • App Intents
    • Apple Intelligence
    • Games
    • Machine Learning & AI
    • Security
    • Xcode Cloud
    • Community

    Explore Community

    • Overview
    • Meet with Apple events
    • Community-driven events
    • Developer Forums
    • Open Source

    Featured

    • WWDC
    • Swift Student Challenge
    • Developer Stories
    • App Store Awards
    • Apple Design Awards
    • Apple Developer Centers
    • Documentation

    Explore Documentation

    • Documentation Library
    • Technology Overviews
    • Sample Code
    • Human Interface Guidelines
    • Videos

    Release Notes

    • Featured Updates
    • iOS
    • iPadOS
    • macOS
    • watchOS
    • visionOS
    • tvOS
    • Xcode
    • Downloads

    Explore Downloads

    • All Downloads
    • Operating Systems
    • Applications
    • Design Resources

    Featured

    • Xcode
    • TestFlight
    • Fonts
    • SF Symbols
    • Icon Composer
    • Support

    Explore Support

    • Overview
    • Help Guides
    • Developer Forums
    • Feedback Assistant
    • Contact Us

    Featured

    • Account Help
    • App Review Guidelines
    • App Store Connect Help
    • Upcoming Requirements
    • Agreements and Guidelines
    • System Status
  • Quick Links

    • Events
    • News
    • Forums
    • Sample Code
    • Videos
 

Vídeos

Abrir menu Fechar menu
  • Coleções
  • Todos os vídeos
  • Sobre

Mais vídeos

  • Sobre
  • Código
  • Explore more content with MusicKit

    Discover how you can enhance and personalize your app using MusicKit. We'll take you through the latest additions to the MusicKit framework and explore how you can bring music content to your app through requests, metadata, and more.

    Recursos

    • Explore more content with MusicKit
    • MusicKit
      • Vídeo HD
      • Vídeo SD

    Vídeos relacionados

    WWDC22

    • Meet Apple Music API and MusicKit
    • What's new in Swift

    WWDC21

    • Meet MusicKit for Swift
  • Buscar neste vídeo...
    • 4:20 - Existing catalog search request

      // Loading catalog search top results
      
      var searchRequest = MusicCatalogSearchRequest(
        term: "Hello",
        types: [
          Artist.self,
          Album.self,
          Song.self
        ]
      )
      
      let searchResponse = try await searchRequest.response()
      print("\(searchResponse)")
    • 4:44 - Loading catalog search top results

      // Loading catalog search top results
      
      var searchRequest = MusicCatalogSearchRequest(
        term: "Hello",
        types: [
          Artist.self,
          Album.self,
          Song.self
        ]
      )
      
      searchRequest.includeTopResults = true
      let searchResponse = try await searchRequest.response()
      print("\(searchResponse.topResults)")
    • 5:09 - Loading search suggestions

      // Loading suggestions
      
      let request = MusicCatalogSearchSuggestionsRequest(term: "shaz")
      let response = try await request.response()
      print("\(response)")
    • 6:30 - Loading catalog top charts

      // Loading catalog top charts.
      
      let request = MusicCatalogChartsRequest(
        kinds: [.dailyGlobalTop, .mostPlayed, .cityTop],
        types: [Song.self, Playlist.self]
      )
      let response = try await request.response()
      print("\(response.playlistCharts.first)")
    • 8:10 - Loading audio variants

      // Loading audio variants
      
      let album = …
      let detailedAlbum = try await album.with(.audioVariants)
      print("\(detailedAlbum.debugDescription)")
    • 9:09 - Showing currently playing audio variants

      // Showing currently playing audio variants
      
      @ObservedObject var musicPlayerQueue = ApplicationMusicPlayer.shared.queue
      @ObservedObject var musicPlayerState = ApplicationMusicPlayer.shared.state
      
      var body: some View {
        if let currentEntry = musicPlayerQueue.currentEntry {
          VStack {
            MyPlayerEntryView(currentEntry)
            if musicPlayerState.audioVariant == .dolbyAtmos {
              Image("dolby-atmos-badge")
            }
          }
        }
      }
    • 10:28 - Loading recently played containers

      // Loading recently played containers
      
      let request = MusicRecentlyPlayedContainerRequest()
      let response = try await request.response()
      print("\(response)")
    • 10:41 - Loading recently played songs

      // Loading recently played songs
      
      let request = MusicRecentlyPlayedRequest<Song>()
      let response = try await request.response()
      print("\(response)")
    • 11:21 - Loading personal recommendations and printing first recommendation

      // Loading personal recommendations
      
      let request = MusicPersonalRecommendationsRequest()
      let response = try await request.response()
      print("\(response.recommendations.first)")
    • 11:51 - Loading personal recommendations and printing second recommendation

      // Loading personal recommendations
      
      let request = MusicPersonalRecommendationsRequest()
      let response = try await request.response()
      print("\(response.recommendations[1])")
    • 13:36 - Loading library playlists

      @MainActor
      private func loadLibraryPlaylists() async throws {
        let request = MusicLibraryRequest<Playlist>()
        let response = try await request.response()
        self.response = response
      }
    • 14:23 - Displaying library playlists

      List {
        Section(header: Text("Library Playlists").fontWeight(.semibold)) {
          ForEach(response.items) { playlist in
            PlaylistCell(playlist)
          }
        }
      }
    • 15:47 - Fetching all albums in the library

      // Fetching all albums in the library
      
      let request = MusicLibraryRequest<Album>()
      
      let response = try await request.response()
      print("\(response)")
    • 16:38 - Fetching all compilations in the library

      // Fetching all compilations in the library
      
      var request = MusicLibraryRequest<Album>()
      request.filter(matching: \.isCompilation, equalTo: true)
      
      let response = try await request.response()
      print("\(response)")
    • 17:08 - Fetching all dance compilations in the library

      // Fetching all dance compilations in the library
      
      var request = MusicLibraryRequest<Album>()
      request.filter(matching: \.isCompilation, equalTo: true) 
      request.filter(matching: \.genres, contains: danceGenre)
      
      let response = try await request.response()
      print("\(response)")
    • 17:29 - Fetching all downloaded dance compilations in the library

      // Fetching all downloaded dance compilations in the library
      
      var request = MusicLibraryRequest<Album>()
      request.filter(matching: \.isCompilation, equalTo: true) 
      request.filter(matching: \.genres, contains: danceGenre)
      request.includeDownloadedContentOnly = true
      
      let response = try await request.response()
      print("\(response)")
    • 18:29 - Fetching all albums sectioned by genre

      // Fetching all albums sectioned by genre
      
      var request = MusicLibrarySectionedRequest<Genre, Album>()
      
      let response = try await request.response()
      print("\(response)")
    • 19:04 - Fetching all albums sectioned by genre sorted by artist name

      // Fetching all albums sectioned by genre sorted by artist name
      
      var request = MusicLibrarySectionedRequest<Genre, Album>()
      request.sortItems(by: \.artistName, ascending: true)
      
      let response = try await request.response()
      print("\(response)")
    • 20:58 - Fetching relationships using the with method without a preferred source

      // Fetching relationships using the with method
      
      let album = …
      let detailedAlbum = try await album.with(.tracks)
      print("\(album.tracks)")
    • 21:11 - Fetching relationships using the with method and a preferred source

      // Fetching relationships using the with method
      
      let album = …
      let detailedAlbum = try await album.with(.tracks, preferredSource: .library)
      print("\(album.tracks)")
    • 22:09 - Adding a track to a playlist

      Task { 
        try await MusicLibrary.shared(add: selectedTrack, to: playlist)
        isShowingPlaylistPicker = false
      }

Developer Footer

  • Vídeos
  • WWDC22
  • Explore more content with MusicKit
  • Open Menu Close Menu
    • iOS
    • iPadOS
    • macOS
    • tvOS
    • visionOS
    • watchOS
    • App Store
    Open Menu Close Menu
    • Swift
    • SwiftUI
    • Swift Playground
    • TestFlight
    • Xcode
    • Xcode Cloud
    • Icon Composer
    • SF Symbols
    Open Menu Close Menu
    • Accessibility
    • Accessories
    • Apple Intelligence
    • Audio & Video
    • Augmented Reality
    • Business
    • Design
    • Distribution
    • Education
    • Games
    • Health & Fitness
    • In-App Purchase
    • Localization
    • Maps & Location
    • Machine Learning & AI
    • Security
    • Safari & Web
    Open Menu Close Menu
    • Documentation
    • Downloads
    • Sample Code
    • Videos
    Open Menu Close Menu
    • Help Guides & Articles
    • Contact Us
    • Forums
    • Feedback & Bug Reporting
    • System Status
    Open Menu Close Menu
    • Apple Developer
    • App Store Connect
    • Certificates, IDs, & Profiles
    • Feedback Assistant
    Open Menu Close Menu
    • Apple Developer Program
    • Apple Developer Enterprise Program
    • App Store Small Business Program
    • MFi Program
    • Mini Apps Partner Program
    • News Partner Program
    • Video Partner Program
    • Security Bounty Program
    • Security Research Device Program
    Open Menu Close Menu
    • Meet with Apple
    • Apple Developer Centers
    • App Store Awards
    • Apple Design Awards
    • Apple Developer Academies
    • WWDC
    Read the latest news.
    Get the Apple Developer app.
    Copyright © 2026 Apple Inc. All rights reserved.
    Terms of Use Privacy Policy Agreements and Guidelines