Skip to content
This repository has been archived by the owner on Dec 28, 2024. It is now read-only.

Commit

Permalink
Repo // Conforming to Swift 6.
Browse files Browse the repository at this point in the history
  • Loading branch information
ShikiSuen committed Jun 13, 2024
1 parent 0dd8ab5 commit 4680c45
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 11 deletions.
8 changes: 7 additions & 1 deletion Common/Extension/EnkaHSRImpl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
8 changes: 7 additions & 1 deletion Common/Extension/MiHoYoAPIError+LocalizedError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
8 changes: 7 additions & 1 deletion Features/Daily Note/View/InAppDailyNoteCardView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
32 changes: 28 additions & 4 deletions Features/Gacha/Model/GachaRelatedDescriptionExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions HSRPizzaHelper.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
}

Expand Down
8 changes: 7 additions & 1 deletion Packages/NewsKitHSR/Sources/NewsKitHSR/Views/NewsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4680c45

Please sign in to comment.