diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 00067a53..80aed632 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -43,7 +43,8 @@ jobs: --disable-indexing \ --transform-for-static-hosting \ --hosting-base-path TMDb \ - --output-path docs + --output-path docs \ + --warnings-as-errors env: SWIFTCI_DOCC: 1 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 297a0e6b..da009074 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -19,13 +19,14 @@ concurrency: jobs: swiftLint: name: SwiftLint - runs-on: ubuntu-latest - container: - image: docker://ghcr.io/realm/swiftlint:0.53.0 + runs-on: macos-14 steps: - name: Checkout uses: actions/checkout@v4 + - name: Install swiftlint + run: brew install swiftlint + - name: Swiftlint run: swiftlint --strict --reporter github-actions-logging diff --git a/Makefile b/Makefile index 760e51df..3733bf05 100644 --- a/Makefile +++ b/Makefile @@ -2,10 +2,10 @@ TARGET = TMDb TEST_TARGET = TMDbTests INTEGRATION_TEST_TARGET = TMDbIntegrationTests -IOS_DESTINATION = 'platform=iOS Simulator,name=iPhone 15,OS=17.4' -WATCHOS_DESINTATION = 'platform=watchOS Simulator,name=Apple Watch Series 9 (45mm),OS=10.4' -TVOS_DESTINATION = 'platform=tvOS Simulator,name=Apple TV 4K (3rd generation),OS=17.4' -VISIONOS_DESTINATION = 'platform=visionOS Simulator,name=Apple Vision Pro,OS=1.1' +IOS_DESTINATION = 'platform=iOS Simulator,name=iPhone 15,OS=17.5' +WATCHOS_DESINTATION = 'platform=watchOS Simulator,name=Apple Watch Series 9 (45mm),OS=10.5' +TVOS_DESTINATION = 'platform=tvOS Simulator,name=Apple TV 4K (3rd generation),OS=17.5' +VISIONOS_DESTINATION = 'platform=visionOS Simulator,name=Apple Vision Pro,OS=1.2' SWIFT_CONTAINER_IMAGE = swift:5.9.2-jammy @@ -47,7 +47,7 @@ build-linux-release: .PHONY: build-docs build-docs: - SWIFTCI_DOCC=1 swift package generate-documentation --product $(TARGET) + SWIFTCI_DOCC=1 swift package generate-documentation --product $(TARGET) --warnings-as-errors swift package resolve .PHONY: preview-docs @@ -90,7 +90,7 @@ test-visionos: .PHONY: test-linux test-linux: - docker run --rm -v "$${PWD}:/workspace" -w /workspace $(SWIFT_CONTAINER_IMAGE) /bin/bash -cl "swift build --build-tests -Xswiftc -warnings-as-errors && swift test --skip-build --filter $(TEST_TARGET)" + docker run -i --rm -v "$${PWD}:/workspace" -w /workspace $(SWIFT_CONTAINER_IMAGE) /bin/bash -cl "swift build --build-tests -Xswiftc -warnings-as-errors && swift test --skip-build --filter $(TEST_TARGET)" .PHONY: integration-test integration-test: .check-env-vars diff --git a/README.md b/README.md index 72d50021..efad085a 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ Add the TMDb package as a dependency to your `Package.swift` file, and add it as a dependency to your target. ```swift -// swift-tools-version:5.10 +// swift-tools-version:5.9 import PackageDescription diff --git a/Sources/TMDb/Domain/Models/MovieExternalLinksCollection.swift b/Sources/TMDb/Domain/Models/MovieExternalLinksCollection.swift index 2df8e56f..4945fdd0 100644 --- a/Sources/TMDb/Domain/Models/MovieExternalLinksCollection.swift +++ b/Sources/TMDb/Domain/Models/MovieExternalLinksCollection.swift @@ -81,24 +81,6 @@ public struct MovieExternalLinksCollection: Identifiable, Codable, Equatable, Ha self.twitter = twitter } - public func hash(into hasher: inout Hasher) { - hasher.combine(id) - hasher.combine(imdb?.id) - hasher.combine(wikiData?.id) - hasher.combine(facebook?.id) - hasher.combine(instagram?.id) - hasher.combine(twitter?.id) - } - - public static func == (lhs: MovieExternalLinksCollection, rhs: MovieExternalLinksCollection) -> Bool { - lhs.id == rhs.id - && lhs.imdb == rhs.imdb - && lhs.wikiData == rhs.wikiData - && lhs.facebook == rhs.facebook - && lhs.instagram == rhs.instagram - && lhs.twitter == rhs.twitter - } - } public extension MovieExternalLinksCollection { diff --git a/Sources/TMDb/Domain/Models/PersonExternalLinksCollection.swift b/Sources/TMDb/Domain/Models/PersonExternalLinksCollection.swift index 31186dfd..b94c21c4 100644 --- a/Sources/TMDb/Domain/Models/PersonExternalLinksCollection.swift +++ b/Sources/TMDb/Domain/Models/PersonExternalLinksCollection.swift @@ -89,26 +89,6 @@ public struct PersonExternalLinksCollection: Identifiable, Codable, Equatable, H self.tikTok = tikTok } - public func hash(into hasher: inout Hasher) { - hasher.combine(id) - hasher.combine(imdb?.id) - hasher.combine(wikiData?.id) - hasher.combine(facebook?.id) - hasher.combine(instagram?.id) - hasher.combine(twitter?.id) - hasher.combine(tikTok?.id) - } - - public static func == (lhs: PersonExternalLinksCollection, rhs: PersonExternalLinksCollection) -> Bool { - lhs.id == rhs.id - && lhs.imdb == rhs.imdb - && lhs.wikiData == rhs.wikiData - && lhs.facebook == rhs.facebook - && lhs.instagram == rhs.instagram - && lhs.twitter == rhs.twitter - && lhs.tikTok == rhs.tikTok - } - } public extension PersonExternalLinksCollection { diff --git a/Sources/TMDb/Domain/Models/TMDbError.swift b/Sources/TMDb/Domain/Models/TMDbError.swift index 48d86d8e..ae20b78e 100644 --- a/Sources/TMDb/Domain/Models/TMDbError.swift +++ b/Sources/TMDb/Domain/Models/TMDbError.swift @@ -55,7 +55,9 @@ public enum TMDbError: Equatable, LocalizedError, Sendable { public extension TMDbError { + /// /// A localized message describing what error occurred. + /// var errorDescription: String? { switch self { case .notFound: diff --git a/Sources/TMDb/Domain/Models/TVSeriesExternalLinksCollection.swift b/Sources/TMDb/Domain/Models/TVSeriesExternalLinksCollection.swift index 771a5ac2..c0a23ea2 100644 --- a/Sources/TMDb/Domain/Models/TVSeriesExternalLinksCollection.swift +++ b/Sources/TMDb/Domain/Models/TVSeriesExternalLinksCollection.swift @@ -81,24 +81,6 @@ public struct TVSeriesExternalLinksCollection: Identifiable, Codable, Equatable, self.twitter = twitter } - public func hash(into hasher: inout Hasher) { - hasher.combine(id) - hasher.combine(imdb?.id) - hasher.combine(wikiData?.id) - hasher.combine(facebook?.id) - hasher.combine(instagram?.id) - hasher.combine(twitter?.id) - } - - public static func == (lhs: TVSeriesExternalLinksCollection, rhs: TVSeriesExternalLinksCollection) -> Bool { - lhs.id == rhs.id - && lhs.imdb == rhs.imdb - && lhs.wikiData == rhs.wikiData - && lhs.facebook == rhs.facebook - && lhs.instagram == rhs.instagram - && lhs.twitter == rhs.twitter - } - } public extension TVSeriesExternalLinksCollection { diff --git a/Sources/TMDb/TMDb.docc/Extensions/DiscoverService.md b/Sources/TMDb/TMDb.docc/Extensions/DiscoverService.md index e95fe437..bf7fe620 100644 --- a/Sources/TMDb/TMDb.docc/Extensions/DiscoverService.md +++ b/Sources/TMDb/TMDb.docc/Extensions/DiscoverService.md @@ -8,7 +8,7 @@ ### Discover Movies -- ``movies(sortedBy:withPeople:page:language:)`` +- ``movies(filter:sortedBy:page:language:)`` ### Discover TV Series diff --git a/Tests/TMDbTests/Domain/Models/PersonCombinedCreditsTests.swift b/Tests/TMDbTests/Domain/Models/PersonCombinedCreditsTests.swift index c82d04f5..08f73b61 100644 --- a/Tests/TMDbTests/Domain/Models/PersonCombinedCreditsTests.swift +++ b/Tests/TMDbTests/Domain/Models/PersonCombinedCreditsTests.swift @@ -31,6 +31,36 @@ final class PersonCombinedCreditsTests: XCTestCase { XCTAssertEqual(result.crew, personCombinedCredits.crew) } + func testAllShows() { + let credits = PersonCombinedCredits( + id: 1, + cast: [ + .movie(Movie(id: 1, title: "Movie 1")), + .movie(Movie(id: 2, title: "Movie 2")), + .tvSeries(TVSeries(id: 11, name: "TV 1")), + .tvSeries(TVSeries(id: 12, name: "TV 2")) + ], + crew: [ + .movie(Movie(id: 1, title: "Movie 1")), + .movie(Movie(id: 3, title: "Movie 3")), + .tvSeries(TVSeries(id: 11, name: "TV 1")), + .tvSeries(TVSeries(id: 13, name: "TV 3")) + ] + ) + let expectedResult: [Show] = [ + .movie(Movie(id: 1, title: "Movie 1")), + .movie(Movie(id: 2, title: "Movie 2")), + .movie(Movie(id: 3, title: "Movie 3")), + .tvSeries(TVSeries(id: 11, name: "TV 1")), + .tvSeries(TVSeries(id: 12, name: "TV 2")), + .tvSeries(TVSeries(id: 13, name: "TV 3")) + ].sorted { $0.id < $1.id } + + let result = credits.allShows.sorted { $0.id < $1.id } + + XCTAssertEqual(result, expectedResult) + } + // swiftlint:disable line_length private let personCombinedCredits = PersonCombinedCredits( id: 287,