From 357a2cbca106daf42bc892b251802bfa00895598 Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Thu, 7 Dec 2023 09:15:39 -0800 Subject: [PATCH] fix: set appearance in iOS 17+ (#818) * fix: set appearance in iOS 17+ * only xcode 15+ * set proper clang version * simplify * fix Xcode warning --- WebDriverAgentLib/Categories/XCUIDevice+FBHelpers.m | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/WebDriverAgentLib/Categories/XCUIDevice+FBHelpers.m b/WebDriverAgentLib/Categories/XCUIDevice+FBHelpers.m index 5f138f381..b0b008348 100644 --- a/WebDriverAgentLib/Categories/XCUIDevice+FBHelpers.m +++ b/WebDriverAgentLib/Categories/XCUIDevice+FBHelpers.m @@ -339,6 +339,16 @@ - (BOOL)fb_setAppearance:(FBUIInterfaceAppearance)appearance error:(NSError **)e [invocation invoke]; return YES; } + +#if __clang_major__ >= 15 || (__clang_major__ >= 14 && __clang_minor__ >= 0 && __clang_patchlevel__ >= 3) + // Xcode 14.3.1 can build these values. + // For iOS 17+ + if ([self respondsToSelector:NSSelectorFromString(@"appearance")]) { + self.appearance = (XCUIDeviceAppearance) appearance; + return YES; + } +#endif + return [[[FBErrorBuilder builder] withDescriptionFormat:@"Current Xcode SDK does not support appearance changing"] buildError:error];