From eb5ab42b4e1dec7d7743943c74b33cf835dfeabe Mon Sep 17 00:00:00 2001 From: Luke Redpath Date: Fri, 29 Oct 2021 15:30:34 +0100 Subject: [PATCH] Fixes attribute graph cycle errors in Xcode 13. I'd hope to avoid this brute-force approach but this seems to be the only way to ensure there aren't nested view updates triggered by changing the textfield responder state. --- .../ResponsiveTextFieldDemo.xcodeproj/project.pbxproj | 4 ++-- Sources/ResponsiveTextField/ResponsiveTextField.swift | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Demo Project/ResponsiveTextFieldDemo.xcodeproj/project.pbxproj b/Demo Project/ResponsiveTextFieldDemo.xcodeproj/project.pbxproj index 44c3f18..3c34cb6 100644 --- a/Demo Project/ResponsiveTextFieldDemo.xcodeproj/project.pbxproj +++ b/Demo Project/ResponsiveTextFieldDemo.xcodeproj/project.pbxproj @@ -281,7 +281,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = ZZVQ8B5T69; + DEVELOPMENT_TEAM = Y4FPFWU22N; ENABLE_PREVIEWS = YES; INFOPLIST_FILE = ResponsiveTextFieldDemo/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 14.0; @@ -302,7 +302,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = ZZVQ8B5T69; + DEVELOPMENT_TEAM = Y4FPFWU22N; ENABLE_PREVIEWS = YES; INFOPLIST_FILE = ResponsiveTextFieldDemo/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 14.0; diff --git a/Sources/ResponsiveTextField/ResponsiveTextField.swift b/Sources/ResponsiveTextField/ResponsiveTextField.swift index 7a61ea9..30fb01f 100644 --- a/Sources/ResponsiveTextField/ResponsiveTextField.swift +++ b/Sources/ResponsiveTextField/ResponsiveTextField.swift @@ -344,9 +344,9 @@ extension ResponsiveTextField: UIViewRepresentable { switch (uiView.isFirstResponder, firstResponderDemand?.wrappedValue) { case (true, .shouldResignFirstResponder): - uiView.resignFirstResponder() + RunLoop.main.schedule { uiView.resignFirstResponder() } case (false, .shouldBecomeFirstResponder): - uiView.becomeFirstResponder() + RunLoop.main.schedule { uiView.becomeFirstResponder() } case (_, nil): // If there is no demand then there's nothing to do. break