Skip to content

Commit

Permalink
Fix potential memory/controller leak
Browse files Browse the repository at this point in the history
  • Loading branch information
keleftheriou committed Jan 1, 2024
1 parent 293d21b commit ecbfe9d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Sources/FlickTypeKit/FlickTypeKit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,9 @@ public extension WKInterfaceController {
internal func presentSystemInputController(_ invocation: TextInputInvocation) {

let flickTypeText = "⌨︎\tFlickType\n\tKeyboard"
func completionWrapper(textInputControllerReturnedItems: [Any]?) {
if let inputText = textInputControllerReturnedItems?.first as? String {
// Ensure we only hold a weak reference to self here
let completionWrapper: ([Any]?) -> Void = { [weak self] textInputControllerReturnedItems in
if let self, let inputText = textInputControllerReturnedItems?.first as? String {
if inputText == flickTypeText {
return presentFlickTypeOrIntermediateController(invocation)
}
Expand Down

0 comments on commit ecbfe9d

Please sign in to comment.