Skip to content

Resolve retained cycle issues with onButtonClicked(_:), onActionButtonClicked(_:) and onTextChanged(_:)#17

Open
rlarjsdn3 wants to merge 1 commit intodinhquan:masterfrom
rlarjsdn3:solve-retained-cycle-issue
Open

Resolve retained cycle issues with onButtonClicked(_:), onActionButtonClicked(_:) and onTextChanged(_:)#17
rlarjsdn3 wants to merge 1 commit intodinhquan:masterfrom
rlarjsdn3:solve-retained-cycle-issue

Conversation

@rlarjsdn3
Copy link

@rlarjsdn3 rlarjsdn3 commented Jan 3, 2025

I resolved the strong reference cycle issue caused by the above method. The root cause of the cycle was that the SwiftAlertView object strongly referenced the onButtonClicked closure, while the closure also referenced the SwiftAlertView object through self. I resolved the issue by adding the [unowned self] keyword to the closure.

thanks.

@rlarjsdn3 rlarjsdn3 changed the title Solve retained cycle issue with onButtonClicked(_:), onActionButtonClicked(_:) and onTextChanged(_:) Resolve retained cycle issues with onButtonClicked(_:), onActionButtonClicked(_:) and onTextChanged(_:) Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant