From 8ef17080a8c211b0b406d01a980092ee092c8e10 Mon Sep 17 00:00:00 2001 From: Kenta Kubo <601636+kkebo@users.noreply.github.com> Date: Sun, 9 Mar 2025 01:38:00 +0900 Subject: [PATCH 1/6] build: bump swift-tools-version to 6.0 It also enables Swift 6 language mode on Swift Playground. --- Package.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Package.swift b/Package.swift index 423447f..d7f024a 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version: 5.8 +// swift-tools-version: 6.0 // WARNING: // This file is automatically generated. From 5d42bc08337f39e9649ad1a59ff08a5442354877 Mon Sep 17 00:00:00 2001 From: Kenta Kubo <601636+kkebo@users.noreply.github.com> Date: Sun, 9 Mar 2025 01:40:27 +0900 Subject: [PATCH 2/6] revert: fix: avoid errors in Swift Playgrounds Swift Playground can't import the PlaygroundSupport module anymore when opening an App project. --- DNSecure/Views/ContentView.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/DNSecure/Views/ContentView.swift b/DNSecure/Views/ContentView.swift index a9e4b01..79d7513 100644 --- a/DNSecure/Views/ContentView.swift +++ b/DNSecure/Views/ContentView.swift @@ -66,7 +66,7 @@ struct ContentView { } private func updateStatus() { - #if !targetEnvironment(simulator) && !canImport(PlaygroundSupport) + #if !targetEnvironment(simulator) let manager = NEDNSSettingsManager.shared() manager.loadFromPreferences { if let err = $0 { @@ -84,7 +84,7 @@ struct ContentView { self.usedID = server.id.uuidString } - #if !targetEnvironment(simulator) && !canImport(PlaygroundSupport) + #if !targetEnvironment(simulator) let manager = NEDNSSettingsManager.shared() manager.dnsSettings = server.configuration.toDNSSettings() manager.onDemandRules = server.onDemandRules.toNEOnDemandRules() @@ -108,7 +108,7 @@ struct ContentView { private func removeSettings() { self.usedID = nil - #if !targetEnvironment(simulator) && !canImport(PlaygroundSupport) + #if !targetEnvironment(simulator) let manager = NEDNSSettingsManager.shared() guard manager.dnsSettings != nil else { // Already removed From ebb9cf90a7885a47cdc58d199572d169b2f789b6 Mon Sep 17 00:00:00 2001 From: Kenta Kubo <601636+kkebo@users.noreply.github.com> Date: Sun, 9 Mar 2025 01:41:10 +0900 Subject: [PATCH 3/6] fix: fix errors in Swift 6 language mode --- DNSecure/Views/ContentView.swift | 1 + DNSecure/Views/DetailView.swift | 1 + 2 files changed, 2 insertions(+) diff --git a/DNSecure/Views/ContentView.swift b/DNSecure/Views/ContentView.swift index 79d7513..6e129c8 100644 --- a/DNSecure/Views/ContentView.swift +++ b/DNSecure/Views/ContentView.swift @@ -133,6 +133,7 @@ struct ContentView { } } +@MainActor extension ContentView: View { var body: some View { if #available(iOS 16, *) { diff --git a/DNSecure/Views/DetailView.swift b/DNSecure/Views/DetailView.swift index e8b4085..56782b3 100644 --- a/DNSecure/Views/DetailView.swift +++ b/DNSecure/Views/DetailView.swift @@ -19,6 +19,7 @@ struct DetailView { } } +@MainActor extension DetailView: View { var body: some View { if #available(iOS 16, *) { From 56cd5b15ed3ed0d56281ea518690cfbdf919a753 Mon Sep 17 00:00:00 2001 From: Kenta Kubo <601636+kkebo@users.noreply.github.com> Date: Sun, 9 Mar 2025 01:55:50 +0900 Subject: [PATCH 4/6] build: enable Swift 6 language mode on Xcode --- DNSecure.xcodeproj/project.pbxproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DNSecure.xcodeproj/project.pbxproj b/DNSecure.xcodeproj/project.pbxproj index 9c85732..5a591d4 100644 --- a/DNSecure.xcodeproj/project.pbxproj +++ b/DNSecure.xcodeproj/project.pbxproj @@ -547,7 +547,7 @@ SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTS_MACCATALYST = YES; SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; - SWIFT_VERSION = 5.0; + SWIFT_VERSION = 6.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; @@ -574,7 +574,7 @@ SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTS_MACCATALYST = YES; SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; - SWIFT_VERSION = 5.0; + SWIFT_VERSION = 6.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; From c2f2953b4e13ef2d9cb88238fbae6299b780a01e Mon Sep 17 00:00:00 2001 From: Kenta Kubo <601636+kkebo@users.noreply.github.com> Date: Sun, 9 Mar 2025 01:56:23 +0900 Subject: [PATCH 5/6] fix: fix retroactive conformance warnings --- DNSecure/Extensions/NEOnDemandRuleAction+CaseIterable.swift | 2 +- .../NEOnDemandRuleAction+CustomStringConvertible.swift | 2 +- .../Extensions/NEOnDemandRuleInterfaceType+CaseIterable.swift | 2 +- .../NEOnDemandRuleInterfaceType+CustomStringConvertible.swift | 2 +- DNSecure/Models/Resolver.swift | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/DNSecure/Extensions/NEOnDemandRuleAction+CaseIterable.swift b/DNSecure/Extensions/NEOnDemandRuleAction+CaseIterable.swift index 2ae320f..a8ff641 100644 --- a/DNSecure/Extensions/NEOnDemandRuleAction+CaseIterable.swift +++ b/DNSecure/Extensions/NEOnDemandRuleAction+CaseIterable.swift @@ -7,7 +7,7 @@ import NetworkExtension -extension NEOnDemandRuleAction: CaseIterable { +extension NEOnDemandRuleAction: @retroactive CaseIterable { public static var allCases: [Self] { [.connect, .disconnect, .evaluateConnection, .ignore] } diff --git a/DNSecure/Extensions/NEOnDemandRuleAction+CustomStringConvertible.swift b/DNSecure/Extensions/NEOnDemandRuleAction+CustomStringConvertible.swift index 4b309b6..4c0f3f0 100644 --- a/DNSecure/Extensions/NEOnDemandRuleAction+CustomStringConvertible.swift +++ b/DNSecure/Extensions/NEOnDemandRuleAction+CustomStringConvertible.swift @@ -7,7 +7,7 @@ import NetworkExtension -extension NEOnDemandRuleAction: CustomStringConvertible { +extension NEOnDemandRuleAction: @retroactive CustomStringConvertible { public var description: String { switch self { case .connect: diff --git a/DNSecure/Extensions/NEOnDemandRuleInterfaceType+CaseIterable.swift b/DNSecure/Extensions/NEOnDemandRuleInterfaceType+CaseIterable.swift index 2460f00..f03d39f 100644 --- a/DNSecure/Extensions/NEOnDemandRuleInterfaceType+CaseIterable.swift +++ b/DNSecure/Extensions/NEOnDemandRuleInterfaceType+CaseIterable.swift @@ -7,7 +7,7 @@ import NetworkExtension -extension NEOnDemandRuleInterfaceType: CaseIterable { +extension NEOnDemandRuleInterfaceType: @retroactive CaseIterable { public static var allCases: [Self] { #if os(macOS) return [.any, .ethernet, .wiFi] diff --git a/DNSecure/Extensions/NEOnDemandRuleInterfaceType+CustomStringConvertible.swift b/DNSecure/Extensions/NEOnDemandRuleInterfaceType+CustomStringConvertible.swift index cce4a92..fba75cc 100644 --- a/DNSecure/Extensions/NEOnDemandRuleInterfaceType+CustomStringConvertible.swift +++ b/DNSecure/Extensions/NEOnDemandRuleInterfaceType+CustomStringConvertible.swift @@ -7,7 +7,7 @@ import NetworkExtension -extension NEOnDemandRuleInterfaceType: CustomStringConvertible { +extension NEOnDemandRuleInterfaceType: @retroactive CustomStringConvertible { public var description: String { switch self { case .any: diff --git a/DNSecure/Models/Resolver.swift b/DNSecure/Models/Resolver.swift index 4e71140..547bd4f 100644 --- a/DNSecure/Models/Resolver.swift +++ b/DNSecure/Models/Resolver.swift @@ -215,7 +215,7 @@ extension Resolvers { } } -extension Resolvers: RawRepresentable { +extension Resolvers: @retroactive RawRepresentable { public init?(rawValue: String) { guard let data = rawValue.data(using: .utf8), let result = try? JSONDecoder().decode(Self.self, from: data) From 76de00f80112fa4d322a66a9e9fa9cbfb3c538a5 Mon Sep 17 00:00:00 2001 From: Kenta Kubo <601636+kkebo@users.noreply.github.com> Date: Sun, 9 Mar 2025 01:57:16 +0900 Subject: [PATCH 6/6] build: apply recommended Xcode settings --- DNSecure.xcodeproj/project.pbxproj | 6 +----- DNSecure.xcodeproj/xcshareddata/xcschemes/DNSecure.xcscheme | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/DNSecure.xcodeproj/project.pbxproj b/DNSecure.xcodeproj/project.pbxproj index 5a591d4..2c4476a 100644 --- a/DNSecure.xcodeproj/project.pbxproj +++ b/DNSecure.xcodeproj/project.pbxproj @@ -285,7 +285,7 @@ attributes = { BuildIndependentTargetsInParallel = YES; LastSwiftUpdateCheck = 1200; - LastUpgradeCheck = 1510; + LastUpgradeCheck = 1620; TargetAttributes = { 8940023724ACBD2700EBE74B = { CreatedOnToolsVersion = 12.0; @@ -582,7 +582,6 @@ 8940026124ACBD2800EBE74B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; BUNDLE_LOADER = "$(TEST_HOST)"; CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = X4678G5DL2; @@ -603,7 +602,6 @@ 8940026224ACBD2800EBE74B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; BUNDLE_LOADER = "$(TEST_HOST)"; CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = X4678G5DL2; @@ -624,7 +622,6 @@ 8940026424ACBD2800EBE74B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = X4678G5DL2; INFOPLIST_FILE = DNSecureUITests/Info.plist; @@ -644,7 +641,6 @@ 8940026524ACBD2800EBE74B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = X4678G5DL2; INFOPLIST_FILE = DNSecureUITests/Info.plist; diff --git a/DNSecure.xcodeproj/xcshareddata/xcschemes/DNSecure.xcscheme b/DNSecure.xcodeproj/xcshareddata/xcschemes/DNSecure.xcscheme index 4bdfabd..dbf1654 100644 --- a/DNSecure.xcodeproj/xcshareddata/xcschemes/DNSecure.xcscheme +++ b/DNSecure.xcodeproj/xcshareddata/xcschemes/DNSecure.xcscheme @@ -1,6 +1,6 @@