Skip to content
This repository has been archived by the owner on Aug 24, 2019. It is now read-only.

Expose execute function to Objective-C API's #30

Closed
wants to merge 2 commits into from
Closed

Expose execute function to Objective-C API's #30

wants to merge 2 commits into from

Conversation

basememara
Copy link
Contributor

Allows encapsulation of debounce logic in lazy loaded properties and feed into legacy Objective-C API's like NotificationCenter, see #selector(refreshProgress.execute):

class ViewController: UIViewController {
	
    lazy var refreshProgress: DebouncedLimiter = {
        return DebouncedLimiter(limit: 3) { [weak self] in
            self?.debouncedExecutionCount += 1
        }
    }()

    override func viewDidLoad() {
        super.viewDidLoad()

        NotificationCenter.default.addObserver(refreshProgress,
            selector: #selector(refreshProgress.execute),
            name: .UIApplicationDidBecomeActive,
            object: nil
        )
    }
}

@basememara basememara closed this by deleting the head repository Oct 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant