diff --git a/Sources/MusadoraKit/Add Resources/CreatePlaylist.swift b/Sources/MusadoraKit/Add Resources/CreatePlaylist.swift index 84b5ef536..5df9923c9 100644 --- a/Sources/MusadoraKit/Add Resources/CreatePlaylist.swift +++ b/Sources/MusadoraKit/Add Resources/CreatePlaylist.swift @@ -11,7 +11,6 @@ import Foundation @available(macOS 14.0, *) public extension MLibrary { -#if compiler(>=5.7) /// Creates a playlist in the user’s music library. /// /// - Parameters: @@ -41,7 +40,6 @@ public extension MLibrary { @available(macCatalyst, unavailable) static func createPlaylist(with name: String, author: String? = nil, description: String? = nil, items: Songs) async throws -> Playlist { try await MusicLibrary.shared.createPlaylist(name: name, description: description, authorDisplayName: author, items: items) } -#endif /// Creates a playlist in the user’s music library. /// diff --git a/Sources/MusadoraKit/Catalog/CatalogChart.swift b/Sources/MusadoraKit/Catalog/CatalogChart.swift index d655fc1d6..b8d962b33 100644 --- a/Sources/MusadoraKit/Catalog/CatalogChart.swift +++ b/Sources/MusadoraKit/Catalog/CatalogChart.swift @@ -5,7 +5,6 @@ // Created by Rudrank Riyam on 22/06/22. // -#if compiler(>=5.7) /// Represents types of music catalog charts available in Apple Music. /// /// These types can be songs, albums, playlists or music videos. @@ -260,4 +259,3 @@ extension MCatalog { return response } } -#endif diff --git a/Sources/MusadoraKit/Catalog/CatalogGenre.swift b/Sources/MusadoraKit/Catalog/CatalogGenre.swift index 4d23c03ab..20075e910 100644 --- a/Sources/MusadoraKit/Catalog/CatalogGenre.swift +++ b/Sources/MusadoraKit/Catalog/CatalogGenre.swift @@ -37,7 +37,6 @@ public extension MCatalog { /// Fetch top genres from the Apple Music catalog. /// - Returns: Top `Genres`. static func topGenres() async throws -> Genres { -#if compiler(>=5.7) if #available(iOS 16.0, macOS 13.0, tvOS 16.0, watchOS 9.0, *) { let request = MusicCatalogResourceRequest() let response = try await request.response() @@ -46,10 +45,6 @@ public extension MCatalog { let storefront = try await MusicDataRequest.currentCountryCode return try await topGenres(for: storefront) } -#else - let storefront = try await MusicDataRequest.currentCountryCode - return try await topGenres(for: storefront) -#endif } /// Fetch top genres from the Apple Music catalog for a particular storefront. diff --git a/Sources/MusadoraKit/Catalog/CatalogRecordLabel.swift b/Sources/MusadoraKit/Catalog/CatalogRecordLabel.swift index f8696b6ee..68b7734ae 100644 --- a/Sources/MusadoraKit/Catalog/CatalogRecordLabel.swift +++ b/Sources/MusadoraKit/Catalog/CatalogRecordLabel.swift @@ -7,6 +7,7 @@ public extension MCatalog { /// Fetch a record label from the Apple Music catalog by using its identifier. + /// /// - Parameters: /// - id: The unique identifier for the record label. /// - properties: Additional relationships to fetch with the record label. @@ -23,8 +24,8 @@ public extension MCatalog { return recordLabel } -#if compiler(>=5.7) /// Fetch a record label from the Apple Music catalog by using its identifier with all properties. + /// /// - Parameters: /// - id: The unique identifier for the record label. /// - Returns: `RecordLabel` matching the given identifier. @@ -38,9 +39,9 @@ public extension MCatalog { } return recordLabel } -#endif /// Fetch multiple record labels from the Apple Music catalog by using their identifiers. + /// /// - Parameters: /// - ids: The unique identifiers for the record labels. /// - properties: Additional relationships to fetch with the record labels. @@ -53,8 +54,8 @@ public extension MCatalog { return response.items } -#if compiler(>=5.7) /// Fetch multiple record labels from the Apple Music catalog by using their identifiers with all properties. + /// /// - Parameters: /// - ids: The unique identifiers for the record labels. /// - Returns: `RecordLabels` matching the given identifiers. @@ -64,5 +65,4 @@ public extension MCatalog { let response = try await request.response() return response.items } -#endif } diff --git a/Sources/MusadoraKit/Catalog/CatalogSearch.swift b/Sources/MusadoraKit/Catalog/CatalogSearch.swift index e8a113bc5..5f0493c36 100644 --- a/Sources/MusadoraKit/Catalog/CatalogSearch.swift +++ b/Sources/MusadoraKit/Catalog/CatalogSearch.swift @@ -110,9 +110,9 @@ public extension MCatalog { } } -#if compiler(>=5.7) public extension MCatalog { /// Fetch top results and search suggestions from the Apple Music catalog by using a query term. + /// /// - Parameters: /// - term: The entered text for the search. /// - types: The types of music items to include in the search. @@ -120,8 +120,8 @@ public extension MCatalog { /// - Returns: `MusicCatalogSearchSuggestionsResponse` that returns different top music items and suggestions. @available(iOS 16.0, macOS 13.0, tvOS 16.0, watchOS 9.0, *) static func searchSuggestions(for term: String, - types: [MCatalogSearchType], - limit: Int? = nil) async throws -> MusicCatalogSearchSuggestionsResponse { + types: [MCatalogSearchType], + limit: Int? = nil) async throws -> MusicCatalogSearchSuggestionsResponse { let searchTypes = types.compactMap { $0.type } var request = MusicCatalogSearchSuggestionsRequest(term: term, includingTopResultsOfTypes: searchTypes) request.limit = limit @@ -130,6 +130,7 @@ public extension MCatalog { } /// Fetch search suggestions from the Apple Music catalog by using a query term. + /// /// - Parameters: /// - term: The entered text for the search. /// - types: The types of music items to include in the search. @@ -144,4 +145,3 @@ public extension MCatalog { return response.suggestions } } -#endif diff --git a/Sources/MusadoraKit/Catalog/MCatalogSearchType.swift b/Sources/MusadoraKit/Catalog/MCatalogSearchType.swift index 5641b77d5..bbbcebc9d 100644 --- a/Sources/MusadoraKit/Catalog/MCatalogSearchType.swift +++ b/Sources/MusadoraKit/Catalog/MCatalogSearchType.swift @@ -58,15 +58,12 @@ public enum MCatalogSearchType { extension MCatalogSearchTypes { public static var all: Self { var types: Self = [.songs, .albums, .playlists, .artists, .stations, .recordLabels] -#if compiler(>=5.7) + if #available(iOS 15.4, macOS 12.3, tvOS 15.4, watchOS 9.0, *) { types += [.musicVideos, .curators, .radioShows] return types } else { return types } -#else - return types -#endif } } diff --git a/Sources/MusadoraKit/History/RecentlyPlayed.swift b/Sources/MusadoraKit/History/RecentlyPlayed.swift index 8a7bdcbce..397099999 100644 --- a/Sources/MusadoraKit/History/RecentlyPlayed.swift +++ b/Sources/MusadoraKit/History/RecentlyPlayed.swift @@ -7,7 +7,6 @@ import Foundation -#if compiler(>=5.7) public extension MHistory { @available(iOS 16.0, macOS 13.0, tvOS 16.0, watchOS 9.0, *) static func recentlyPlayed(limit: Int? = nil) async throws -> MusicItemCollection { @@ -49,7 +48,6 @@ public extension MHistory { return response.items } } -#endif public extension MHistory { /// Fetch the recently played resources for the user. diff --git a/Sources/MusadoraKit/Library/LibraryAlbum.swift b/Sources/MusadoraKit/Library/LibraryAlbum.swift index f7ae56e38..7ac842179 100644 --- a/Sources/MusadoraKit/Library/LibraryAlbum.swift +++ b/Sources/MusadoraKit/Library/LibraryAlbum.swift @@ -58,26 +58,23 @@ public extension MLibrary { } } -#if compiler(>=5.7) /// Fetch multiple albums from the user's library by using their identifiers. /// /// - Parameters: /// - ids: The unique identifiers for the albums. /// - Returns: `Albums` matching the given identifiers. - @available(iOS 16.0, tvOS 16.0, watchOS 9.0, macOS 14.0, macCatalyst 17.0, *) static func albums(ids: [MusicItemID]) async throws -> Albums { - var request = MusicLibraryRequest() - request.filter(matching: \.id, memberOf: ids) - let response = try await request.response() - return response.items - } -#else - static func albums(ids: [MusicItemID]) async throws -> Albums { - let request = MLibraryResourceRequest(matching: \.id, memberOf: ids) - let response = try await request.response() - return response.items + if #available(iOS 16.0, macOS 14.0, macCatalyst 17.0, tvOS 16.0, watchOS 9.0, *) { + var request = MusicLibraryRequest() + request.filter(matching: \.id, memberOf: ids) + let response = try await request.response() + return response.items + } else { + let request = MLibraryResourceRequest(matching: \.id, memberOf: ids) + let response = try await request.response() + return response.items + } } -#endif #if compiler(>=5.7) /// Access the total number of albums in the user's library. @@ -131,7 +128,6 @@ public extension MLibrary { } } -#if compiler(>=5.7) @available(iOS 16.0, tvOS 16.0, watchOS 9.0, macOS 14.0, macCatalyst 17.0, *) public extension MHistory { /// Fetch recently added albums from the user's library sorted by the date added. @@ -162,4 +158,3 @@ public extension MHistory { return response.items } } -#endif diff --git a/Sources/MusadoraKit/Library/LibraryPlaylist.swift b/Sources/MusadoraKit/Library/LibraryPlaylist.swift index 5f73bd013..361493650 100644 --- a/Sources/MusadoraKit/Library/LibraryPlaylist.swift +++ b/Sources/MusadoraKit/Library/LibraryPlaylist.swift @@ -37,100 +37,92 @@ public extension MLibrary { } } -#if compiler(>=5.7) /// Fetch all playlists from the user's library in alphabetical order. /// /// - Parameters: /// - limit: The number of playlists returned. /// - Returns: `Playlists` for the given limit. - @available(iOS 16.0, tvOS 16.0, watchOS 9.0, macOS 14.0, macCatalyst 17.0, *) - static func playlists(limit: Int? = nil) async throws -> Playlists { - let request = MusicLibraryRequest() - let response = try await request.response() - return response.items - } -#else static func playlists(limit: Int? = nil) async throws -> Playlists { - var request = MLibraryResourceRequest() - request.limit = limit - let response = try await request.response() - return response.items + if #available(iOS 16.0, macOS 14.0, macCatalyst 17.0, tvOS 16.0, watchOS 9.0, *) { + let request = MusicLibraryRequest() + let response = try await request.response() + return response.items + } else { + var request = MLibraryResourceRequest() + request.limit = limit + let response = try await request.response() + return response.items + } } -#endif -#if compiler(>=5.7) /// Fetch multiple playlists from the user's library by using their identifiers. /// /// - Parameters: /// - ids: The unique identifiers for the playlists. - @available(iOS 16.0, tvOS 16.0, watchOS 9.0, macOS 14.0, macCatalyst 17.0, *) - static func playlists(ids: [MusicItemID]) async throws -> Playlists { - var request = MusicLibraryRequest() - request.filter(matching: \.id, memberOf: ids) - let response = try await request.response() - return response.items - } -#else static func playlists(ids: [MusicItemID]) async throws -> Playlists { - let request = MLibraryResourceRequest(matching: \.id, memberOf: ids) - let response = try await request.response() - return response.items + if #available(iOS 16.0, macOS 14.0, macCatalyst 17.0, tvOS 16.0, watchOS 9.0, *) { + var request = MusicLibraryRequest() + request.filter(matching: \.id, memberOf: ids) + let response = try await request.response() + return response.items + } else { + let request = MLibraryResourceRequest(matching: \.id, memberOf: ids) + let response = try await request.response() + return response.items + } } -} -#endif #if compiler(>=5.7) -/// Access the total number of playlists in the user's library. -@available(iOS 16.0, tvOS 16.0, watchOS 9.0, macOS 14.0, macCatalyst 17.0, *) -static var playlistsCount: Int { - get async throws { - let request = MusicLibraryRequest() - let response = try await request.response() - return response.items.count + /// Access the total number of playlists in the user's library. + @available(iOS 16.0, tvOS 16.0, watchOS 9.0, macOS 14.0, macCatalyst 17.0, *) + static var playlistsCount: Int { + get async throws { + let request = MusicLibraryRequest() + let response = try await request.response() + return response.items.count + } } -} #else -/// Access the total number of playlists in the user's library. -@available(macOS, unavailable) -@available(macCatalyst, unavailable) -@available(tvOS, unavailable) -@available(watchOS, unavailable) -static var playlistsCount: Int { - get async throws { - if let items = MPMediaQuery.playlists().items { - return items.count - } else { - throw MediaPlayError.notFound(for: "playlists") + /// Access the total number of playlists in the user's library. + @available(macOS, unavailable) + @available(macCatalyst, unavailable) + @available(tvOS, unavailable) + @available(watchOS, unavailable) + static var playlistsCount: Int { + get async throws { + if let items = MPMediaQuery.playlists().items { + return items.count + } else { + throw MediaPlayError.notFound(for: "playlists") + } } } -} #endif -/// Add a playlist to the user's library by using its identifier. -/// -/// - Parameters: -/// - id: The unique identifier for the playlist. -/// - Returns: `Bool` indicating if the insert was successfull or not. -static func addPlaylistToLibrary(id: MusicItemID) async throws -> Bool { - let request = MAddResourcesRequest([(item: .playlists, value: [id])]) - let response = try await request.response() - return response -} + /// Add a playlist to the user's library by using its identifier. + /// + /// - Parameters: + /// - id: The unique identifier for the playlist. + /// - Returns: `Bool` indicating if the insert was successfull or not. + static func addPlaylistToLibrary(id: MusicItemID) async throws -> Bool { + let request = MAddResourcesRequest([(item: .playlists, value: [id])]) + let response = try await request.response() + return response + } -/// Add multiple playlists to the user's library by using their identifiers. -/// -/// - Parameters: -/// - ids: The unique identifiers for the playlists. -/// - Returns: `Bool` indicating if the insert was successfull or not. -static func addPlaylistsToLibrary(ids: [MusicItemID]) async throws -> Bool { - let request = MAddResourcesRequest([(item: .playlists, value: ids)]) - let response = try await request.response() - return response -} + /// Add multiple playlists to the user's library by using their identifiers. + /// + /// - Parameters: + /// - ids: The unique identifiers for the playlists. + /// - Returns: `Bool` indicating if the insert was successfull or not. + static func addPlaylistsToLibrary(ids: [MusicItemID]) async throws -> Bool { + let request = MAddResourcesRequest([(item: .playlists, value: ids)]) + let response = try await request.response() + return response + } } -#if compiler(>=5.7) @available(iOS 16.0, tvOS 16.0, watchOS 9.0, macOS 14.0, macCatalyst 17.0, *) public extension MHistory { /// Fetch recently added playlists from the user's library sorted by the date added. @@ -161,7 +153,6 @@ public extension MHistory { return response.items } } -#endif // MARK: - `LibraryPlaylist` methods public extension MLibrary { diff --git a/Sources/MusadoraKit/Library/LibrarySearch.swift b/Sources/MusadoraKit/Library/LibrarySearch.swift index 561441d79..2e2104938 100644 --- a/Sources/MusadoraKit/Library/LibrarySearch.swift +++ b/Sources/MusadoraKit/Library/LibrarySearch.swift @@ -13,7 +13,6 @@ public enum MLibrarySearchableType { case artists case musicVideos -#if compiler(>=5.7) @available(iOS 16.0, tvOS 16.0, watchOS 9.0, macOS 14.0, macCatalyst 17.0, *) public var libraryType: MusicLibrarySearchable.Type { switch self { @@ -29,7 +28,6 @@ public enum MLibrarySearchableType { return MusicVideo.self } } -#endif public var type: MLibrarySearchable.Type { switch self { @@ -69,7 +67,6 @@ public extension MLibrary { } } -#if compiler(>=5.7) @available(iOS 16.0, tvOS 16.0, watchOS 9.0, macOS 14.0, macCatalyst 17.0, *) public extension MLibrary { static func search( @@ -145,4 +142,3 @@ public extension MLibrary { return response.artists } } -#endif diff --git a/Sources/MusadoraKit/Library/LibrarySong.swift b/Sources/MusadoraKit/Library/LibrarySong.swift index b41eaf580..e9427998f 100644 --- a/Sources/MusadoraKit/Library/LibrarySong.swift +++ b/Sources/MusadoraKit/Library/LibrarySong.swift @@ -98,28 +98,24 @@ public extension MLibrary { } } -#if compiler(>=5.7) /// Fetch multiple songs from the user's library by using their identifiers. /// /// - Parameters: /// - ids: The unique identifiers for the songs. /// - Returns: `Songs` matching the given identifiers. - @available(iOS 16.0, tvOS 16.0, watchOS 9.0, macOS 14.0, macCatalyst 17.0, *) - static func songs(ids: [MusicItemID]) async throws -> Songs { - var request = MusicLibraryRequest() - request.filter(matching: \.id, memberOf: ids) - let response = try await request.response() - return response.items - } -#else static func songs(ids: [MusicItemID]) async throws -> Songs { - let request = MLibraryResourceRequest(matching: \.id, memberOf: ids) - let response = try await request.response() - return response.items + if #available(iOS 16.0, macOS 14.0, macCatalyst 17.0, tvOS 16.0, watchOS 9.0, *) { + var request = MusicLibraryRequest() + request.filter(matching: \.id, memberOf: ids) + let response = try await request.response() + return response.items + } else { + let request = MLibraryResourceRequest(matching: \.id, memberOf: ids) + let response = try await request.response() + return response.items + } } -#endif -#if compiler(>=5.7) /// Fetch a song from the user's library by using its identifier with all properties from the local database. /// /// Use this method to fetch a song from the user's library by providing its unique identifier. @@ -150,7 +146,6 @@ public extension MLibrary { } return try await song.with(properties, preferredSource: .library) } -#endif #if compiler(>=5.7) /// Access the total number of songs in the user's library. @@ -258,7 +253,6 @@ public extension MLibrary { } } -#if compiler(>=5.7) @available(iOS 16.0, tvOS 16.0, watchOS 9.0, macOS 14.0, macCatalyst 17.0, *) public extension MLibrary { @@ -353,7 +347,6 @@ public extension MLibrary { return response.items } } -#endif public extension MLibrary { diff --git a/Sources/MusadoraKit/Music Item Properties/AlbumProperties.swift b/Sources/MusadoraKit/Music Item Properties/AlbumProperties.swift index e2b76e2cf..c153dd8eb 100644 --- a/Sources/MusadoraKit/Music Item Properties/AlbumProperties.swift +++ b/Sources/MusadoraKit/Music Item Properties/AlbumProperties.swift @@ -17,15 +17,12 @@ extension AlbumProperties { /// For iOS 16+, adds the audio variants property. public static var all: Self { var properties: Self = [.artistURL, .genres, .artists, .appearsOn, .otherVersions, .recordLabels, .relatedAlbums, .relatedVideos, .tracks] -#if compiler(>=5.7) + if #available(iOS 16.0, macOS 13.0, tvOS 16.0, watchOS 9.0, *) { properties += [.audioVariants] return properties } else { return properties } -#else - return properties -#endif } } diff --git a/Sources/MusadoraKit/Music Item Properties/PlaylistProperties.swift b/Sources/MusadoraKit/Music Item Properties/PlaylistProperties.swift index dc71425d3..0f77f408f 100644 --- a/Sources/MusadoraKit/Music Item Properties/PlaylistProperties.swift +++ b/Sources/MusadoraKit/Music Item Properties/PlaylistProperties.swift @@ -14,15 +14,12 @@ public typealias PlaylistProperties = [PlaylistProperty] extension PlaylistProperties { public static var all: Self { var properties: Self = [.tracks, .featuredArtists, .moreByCurator] -#if compiler(>=5.7) + if #available(iOS 16.0, macOS 13.0, tvOS 16.0, watchOS 9.0, *) { properties += [.curator, .radioShow] return properties } else { return properties } -#else - return properties -#endif } } diff --git a/Sources/MusadoraKit/Music Item Properties/RecordLabelProperties.swift b/Sources/MusadoraKit/Music Item Properties/RecordLabelProperties.swift index cfce32c2d..4e215e2b2 100644 --- a/Sources/MusadoraKit/Music Item Properties/RecordLabelProperties.swift +++ b/Sources/MusadoraKit/Music Item Properties/RecordLabelProperties.swift @@ -11,10 +11,8 @@ public typealias RecordLabelProperty = PartialMusicAsyncProperty /// Additional properties/relationships of a record label. public typealias RecordLabelProperties = [RecordLabelProperty] -#if compiler(>=5.7) extension RecordLabelProperties { public static var all: Self { [.latestReleases, .topReleases] } } -#endif diff --git a/Sources/MusadoraKit/Music Item Properties/SongProperties.swift b/Sources/MusadoraKit/Music Item Properties/SongProperties.swift index 59c273d2a..5314b816f 100644 --- a/Sources/MusadoraKit/Music Item Properties/SongProperties.swift +++ b/Sources/MusadoraKit/Music Item Properties/SongProperties.swift @@ -14,15 +14,12 @@ public typealias SongProperties = [SongProperty] extension SongProperties { public static var all: Self { var properties: Self = [.albums, .artists, .composers, .genres, .musicVideos, .artistURL, .station] -#if compiler(>=5.7) + if #available(iOS 16.0, macOS 13.0, tvOS 16.0, watchOS 9.0, *) { properties += [.audioVariants] return properties } else { return properties } -#else - return properties -#endif } } diff --git a/Sources/MusadoraKit/Recommendations/MRecommendation+personal.swift b/Sources/MusadoraKit/Recommendations/MRecommendation+personal.swift index 3df46644d..4193a4312 100644 --- a/Sources/MusadoraKit/Recommendations/MRecommendation+personal.swift +++ b/Sources/MusadoraKit/Recommendations/MRecommendation+personal.swift @@ -5,7 +5,6 @@ // Created by Rudrank Riyam on 25/12/22. // -#if compiler(>=5.7) @available(iOS 16.0, macOS 13.0, tvOS 16.0, watchOS 9.0, *) public extension MRecommendation { @@ -100,4 +99,3 @@ extension MRecommendation { return response.recommendations } } -#endif diff --git a/Sources/MusadoraKit/Recommendations/PersonalRecommendations.swift b/Sources/MusadoraKit/Recommendations/PersonalRecommendations.swift index 5553f24bc..6bea057bc 100644 --- a/Sources/MusadoraKit/Recommendations/PersonalRecommendations.swift +++ b/Sources/MusadoraKit/Recommendations/PersonalRecommendations.swift @@ -5,8 +5,6 @@ // Created by Rudrank Riyam on 25/12/22. // -#if compiler(>=5.7) /// A collection of personal recommendations. @available(iOS 16.0, macOS 13.0, tvOS 16.0, watchOS 9.0, *) public typealias PersonalRecommendations = MusicItemCollection -#endif diff --git a/Sources/MusadoraLabsKit/Music Items/Song/SongDetail.swift b/Sources/MusadoraLabsKit/Music Items/Song/SongDetail.swift index 55c7f5394..b0f221dc7 100644 --- a/Sources/MusadoraLabsKit/Music Items/Song/SongDetail.swift +++ b/Sources/MusadoraLabsKit/Music Items/Song/SongDetail.swift @@ -5,7 +5,6 @@ // Created by Rudrank Riyam on 22/07/22. // -#if compiler(>=5.7) @available(iOS 16.0, tvOS 16.0, watchOS 9.0, *, macOS 14.0, macCatalyst 17.0, *) extension Song { public func detail(for type: SongPropertyType) -> String? { @@ -83,4 +82,3 @@ extension Song { } } } -#endif diff --git a/Tests/MusadoraKitTests/MusicItemPropertiesTests.swift b/Tests/MusadoraKitTests/MusicItemPropertiesTests.swift index 041495209..4826d5b1b 100644 --- a/Tests/MusadoraKitTests/MusicItemPropertiesTests.swift +++ b/Tests/MusadoraKitTests/MusicItemPropertiesTests.swift @@ -14,12 +14,10 @@ final class MusicItemPropertiesTests: XCTestCase { let allProperties = PlaylistProperties.all var expectedProperties: Set = [.tracks, .featuredArtists, .moreByCurator] -#if compiler(>=5.7) if #available(iOS 16.0, macOS 13.0, tvOS 16.0, watchOS 9.0, *) { expectedProperties.insert(.curator) expectedProperties.insert(.radioShow) } -#endif XCTAssertTrue(expectedProperties.isSubset(of: allProperties)) } @@ -28,22 +26,18 @@ final class MusicItemPropertiesTests: XCTestCase { let allProperties = SongProperties.all var expectedProperties: Set = [.albums, .artists, .composers, .genres, .musicVideos, .artistURL, .station] -#if compiler(>=5.7) if #available(iOS 16.0, macOS 13.0, tvOS 16.0, watchOS 9.0, *) { expectedProperties.insert(.audioVariants) } -#endif XCTAssertTrue(expectedProperties.isSubset(of: allProperties)) } func testRecordLabelPropertiesAll() { -#if compiler(>=5.7) let allProperties = RecordLabelProperties.all let expectedProperties: Set = [.latestReleases, .topReleases] XCTAssertTrue(expectedProperties.isSubset(of: allProperties)) -#endif } @available(iOS 15.4, macOS 12.3, tvOS 15.4, watchOS 9.0, *) @@ -80,11 +74,9 @@ final class MusicItemPropertiesTests: XCTestCase { let allProperties = AlbumProperties.all var expectedProperties: Set = [.artistURL, .genres, .artists, .appearsOn, .otherVersions, .recordLabels, .relatedAlbums, .relatedVideos, .tracks] -#if compiler(>=5.7) if #available(iOS 16.0, macOS 13.0, tvOS 16.0, watchOS 9.0, *) { expectedProperties.insert(.audioVariants) } -#endif XCTAssertTrue(expectedProperties.isSubset(of: allProperties)) }