@@ -61,6 +61,11 @@ static enum sdk_test isAppAtLeastSpring2021() {
6161 const dyld_build_version_t spring_2021_os_versions = {0xffffffff , 0x007e50301 };
6262 return isAppAtLeast (spring_2021_os_versions);
6363}
64+
65+ static enum sdk_test isAppAtLeastFall2023 () {
66+ const dyld_build_version_t fall_2023_os_versions = {0xffffffff , 0x007e70901 };
67+ return isAppAtLeast (fall_2023_os_versions);
68+ }
6469#endif
6570
6671static _SwiftStdlibVersion binCompatVersionOverride = { 0 };
@@ -189,7 +194,11 @@ bool useLegacyOptionalNilInjectionInCasting() {
189194// by that protocol.
190195bool useLegacyObjCBoxingInCasting () {
191196#if BINARY_COMPATIBILITY_APPLE
192- return false ; // For now, always use the new behavior on Apple OSes
197+ switch (isAppAtLeastFall2023 ()) {
198+ case oldOS: return true ; // Legacy behavior on old OS
199+ case oldApp: return true ; // Legacy behavior for old apps
200+ case newApp: return false ; // New behavior for new apps
201+ }
193202#else
194203 return false ; // Always use the new behavior on non-Apple OSes
195204#endif
@@ -209,7 +218,11 @@ bool useLegacyObjCBoxingInCasting() {
209218
210219bool useLegacySwiftValueUnboxingInCasting () {
211220#if BINARY_COMPATIBILITY_APPLE
212- return false ; // For now, always use the new behavior on Apple OSes
221+ switch (isAppAtLeastFall2023 ()) {
222+ case oldOS: return true ; // Legacy behavior on old OS
223+ case oldApp: return true ; // Legacy behavior for old apps
224+ case newApp: return false ; // New behavior for new apps
225+ }
213226#else
214227 return false ; // Always use the new behavior on non-Apple OSes
215228#endif
0 commit comments