diff --git a/Common/Extension/EnkaHSRImpl.swift b/Common/Extension/EnkaHSRImpl.swift index 6d7509e4..4638f522 100644 --- a/Common/Extension/EnkaHSRImpl.swift +++ b/Common/Extension/EnkaHSRImpl.swift @@ -5,7 +5,13 @@ import EnkaKitHSR import Foundation -extension EnkaHSR.QueryRelated.Exception: LocalizedError { +#if hasFeature(RetroactiveAttribute) +extension EnkaHSR.QueryRelated.Exception: @retroactive LocalizedError {} +#else +extension EnkaHSR.QueryRelated.Exception: LocalizedError {} +#endif + +extension EnkaHSR.QueryRelated.Exception { public var errorDescription: String? { switch self { case let .enkaDBOnlineFetchFailure(details: details): diff --git a/Common/Extension/MiHoYoAPIError+LocalizedError.swift b/Common/Extension/MiHoYoAPIError+LocalizedError.swift index a01925c1..ce9b07f0 100644 --- a/Common/Extension/MiHoYoAPIError+LocalizedError.swift +++ b/Common/Extension/MiHoYoAPIError+LocalizedError.swift @@ -8,7 +8,13 @@ import Foundation import HBMihoyoAPI -extension MiHoYoAPIError: LocalizedError { +#if hasFeature(RetroactiveAttribute) +extension MiHoYoAPIError: @retroactive LocalizedError {} +#else +extension MiHoYoAPIError: LocalizedError {} +#endif + +extension MiHoYoAPIError { public var errorDescription: String? { switch self { case let .other(retcode: retcode, message: message): diff --git a/Features/Daily Note/View/InAppDailyNoteCardView.swift b/Features/Daily Note/View/InAppDailyNoteCardView.swift index 97f1578a..73a70097 100644 --- a/Features/Daily Note/View/InAppDailyNoteCardView.swift +++ b/Features/Daily Note/View/InAppDailyNoteCardView.swift @@ -154,7 +154,13 @@ private struct NoteView: View { // MARK: - ExpeditionInformation.Expedition + View -extension ExpeditionInformation.Expedition: View { +#if hasFeature(RetroactiveAttribute) +extension ExpeditionInformation.Expedition: @retroactive View {} +#else +extension ExpeditionInformation.Expedition: View {} +#endif + +extension ExpeditionInformation.Expedition { public var body: some View { HStack(alignment: .center) { VStack(alignment: .center, spacing: 4) { diff --git a/Features/Gacha/Model/GachaRelatedDescriptionExtension.swift b/Features/Gacha/Model/GachaRelatedDescriptionExtension.swift index c8a2573e..b47c2655 100644 --- a/Features/Gacha/Model/GachaRelatedDescriptionExtension.swift +++ b/Features/Gacha/Model/GachaRelatedDescriptionExtension.swift @@ -10,7 +10,13 @@ import HBMihoyoAPI // MARK: - GachaError + LocalizedError -extension GachaError: LocalizedError { +#if hasFeature(RetroactiveAttribute) +extension GachaError: @retroactive LocalizedError {} +#else +extension GachaError: LocalizedError {} +#endif + +extension GachaError { public var errorDescription: String? { switch self { case let .fetchDataError(page: page, size: size, gachaType: gachaType, error: error): @@ -28,7 +34,13 @@ extension GachaError: LocalizedError { // MARK: - ParseGachaURLError + LocalizedError -extension ParseGachaURLError: LocalizedError { +#if hasFeature(RetroactiveAttribute) +extension ParseGachaURLError: @retroactive LocalizedError {} +#else +extension ParseGachaURLError: LocalizedError {} +#endif + +extension ParseGachaURLError { public var errorDescription: String? { switch self { case .invalidURL: @@ -49,7 +61,13 @@ extension ParseGachaURLError: LocalizedError { // MARK: - GachaType + CustomStringConvertible -extension GachaType: CustomStringConvertible { +#if hasFeature(RetroactiveAttribute) +extension GachaType: @retroactive CustomStringConvertible {} +#else +extension GachaType: CustomStringConvertible {} +#endif + +extension GachaType { public var description: String { switch self { case .characterEventWarp: @@ -66,7 +84,13 @@ extension GachaType: CustomStringConvertible { // MARK: - GachaItem.ItemType + CustomStringConvertible -extension GachaItem.ItemType: CustomStringConvertible { +#if hasFeature(RetroactiveAttribute) +extension GachaItem.ItemType: @retroactive CustomStringConvertible {} +#else +extension GachaItem.ItemType: CustomStringConvertible {} +#endif + +extension GachaItem.ItemType { public var description: String { switch self { case .lightCones: diff --git a/HSRPizzaHelper.xcodeproj/project.pbxproj b/HSRPizzaHelper.xcodeproj/project.pbxproj index 9139c338..1689ddac 100644 --- a/HSRPizzaHelper.xcodeproj/project.pbxproj +++ b/HSRPizzaHelper.xcodeproj/project.pbxproj @@ -1981,7 +1981,7 @@ SDKROOT = iphoneos; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 5.0; + SWIFT_VERSION = 6.0; }; name = Debug; }; @@ -2038,7 +2038,7 @@ SDKROOT = iphoneos; SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OPTIMIZATION_LEVEL = "-O"; - SWIFT_VERSION = 5.0; + SWIFT_VERSION = 6.0; VALIDATE_PRODUCT = YES; }; name = Release; diff --git a/Packages/EnkaKitHSR/Sources/EnkaSwiftUIViews/ShowCaseListView.swift b/Packages/EnkaKitHSR/Sources/EnkaSwiftUIViews/ShowCaseListView.swift index 2a46d40b..4d00b997 100644 --- a/Packages/EnkaKitHSR/Sources/EnkaSwiftUIViews/ShowCaseListView.swift +++ b/Packages/EnkaKitHSR/Sources/EnkaSwiftUIViews/ShowCaseListView.swift @@ -150,7 +150,13 @@ public struct ShowCaseListView: View { // MARK: - Int + Identifiable -extension Int: Identifiable { +#if hasFeature(RetroactiveAttribute) +extension Int: @retroactive Identifiable {} +#else +extension Int: Identifiable {} +#endif + +extension Int { public var id: String { description } } diff --git a/Packages/NewsKitHSR/Sources/NewsKitHSR/Views/NewsView.swift b/Packages/NewsKitHSR/Sources/NewsKitHSR/Views/NewsView.swift index 46af737a..2faba705 100644 --- a/Packages/NewsKitHSR/Sources/NewsKitHSR/Views/NewsView.swift +++ b/Packages/NewsKitHSR/Sources/NewsKitHSR/Views/NewsView.swift @@ -50,7 +50,13 @@ extension NewsKitHSR { // MARK: - View + View -extension [any NewsKitHSR.NewsElement]: View { +#if hasFeature(RetroactiveAttribute) +extension [any NewsKitHSR.NewsElement]: @retroactive View {} +#else +extension [any NewsKitHSR.NewsElement]: View {} +#endif + +extension [any NewsKitHSR.NewsElement] { public var body: some View { List { ForEach(self, id: \.id) { newsElement in