Skip to content

Commit

Permalink
Merge pull request shaps80#63 from roland-schmitz-ocu/issue_62_endles…
Browse files Browse the repository at this point in the history
…s-recursion

Fix endless recursion by avoiding to link _delegates more than once
  • Loading branch information
shaps80 authored Sep 15, 2023
2 parents 1cd2760 + 8bdf039 commit d9c284e
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/shaps80/SwiftBackports",
"state" : {
"revision" : "fafbeabf78b7e364abbbb7565cdfeee42af16211",
"version" : "1.0.2"
"revision" : "ddca6a237c1ba2291d5a3cc47ec8480ce6e9f805",
"version" : "1.0.3"
}
}
],
Expand Down
2 changes: 1 addition & 1 deletion Sources/SwiftUIBackports/iOS/FocusState/ViewFocused.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ private final class Coordinator: NSObject, ObservableObject, UITextFieldDelegate
func observe(field: UITextField) {
self.field = field

if field.delegate !== self {
if field.delegate !== self && _delegate == nil {
_delegate = field.delegate
field.delegate = self
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/SwiftUIBackports/iOS/Presentation/Detents.swift
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ private extension Backport.Representable {
override func willMove(toParent parent: UIViewController?) {
super.willMove(toParent: parent)
if let controller = parent?.sheetPresentationController {
if controller.delegate !== self {
if controller.delegate !== self && _delegate == nil {
_delegate = controller.delegate
controller.delegate = self
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ private extension Backport.Representable {
override func willMove(toParent parent: UIViewController?) {
super.willMove(toParent: parent)
if let controller = parent?.presentationController {
if controller.delegate !== self {
if controller.delegate !== self && _delegate == nil {
_delegate = controller.delegate
controller.delegate = self
}
Expand Down

0 comments on commit d9c284e

Please sign in to comment.