From d5a5f86b3fc3b34aa2fc49c7f57f0a5694820608 Mon Sep 17 00:00:00 2001 From: dadachi Date: Thu, 15 Oct 2026 20:13:24 +0900 Subject: [PATCH] Build the test target in Swift 6 and use the unused response code The app target was already Swift 6, but NativeAppTemplateTests was still Swift 5, so data-race diagnostics in tests were only warnings and the two targets could infer different types from the same closure spelling. The tests already build without errors in Swift 6. ShopCreateViewModelTest declared httpResponseCode but passed a literal 422; it now passes the constant. Ported from MyTurnTagCreator-iOS #150 and #151. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01YDK5huvuRECyVrsQEdTN9q --- NativeAppTemplate.xcodeproj/project.pbxproj | 4 ++-- .../UI/Shop List/ShopCreateViewModelTest.swift | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/NativeAppTemplate.xcodeproj/project.pbxproj b/NativeAppTemplate.xcodeproj/project.pbxproj index e840878..be69182 100644 --- a/NativeAppTemplate.xcodeproj/project.pbxproj +++ b/NativeAppTemplate.xcodeproj/project.pbxproj @@ -1261,7 +1261,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; SWIFT_EMIT_LOC_STRINGS = NO; - SWIFT_VERSION = 5.0; + SWIFT_VERSION = 6.0; TARGETED_DEVICE_FAMILY = "1,2"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/NativeAppTemplate.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/NativeAppTemplate"; }; @@ -1281,7 +1281,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.nativeapptemplate.NativeAppTemplateTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_EMIT_LOC_STRINGS = NO; - SWIFT_VERSION = 5.0; + SWIFT_VERSION = 6.0; TARGETED_DEVICE_FAMILY = "1,2"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/NativeAppTemplate.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/NativeAppTemplate"; }; diff --git a/NativeAppTemplateTests/UI/Shop List/ShopCreateViewModelTest.swift b/NativeAppTemplateTests/UI/Shop List/ShopCreateViewModelTest.swift index a22824b..10d8af2 100644 --- a/NativeAppTemplateTests/UI/Shop List/ShopCreateViewModelTest.swift +++ b/NativeAppTemplateTests/UI/Shop List/ShopCreateViewModelTest.swift @@ -158,7 +158,7 @@ struct ShopCreateViewModelTest { let message = "You can create up to 99 shops across all organizations." let httpResponseCode = 422 - shopRepository.error = NativeAppTemplateAPIError.requestFailed(nil, 422, message) + shopRepository.error = NativeAppTemplateAPIError.requestFailed(nil, httpResponseCode, message) viewModel.createShop() await waitUntil { messageBus.currentMessage != nil }