From 3aa00e48a2a2a454fd5190ff3f660415e893ae0a Mon Sep 17 00:00:00 2001 From: Martin Conte Mac Donell Date: Thu, 10 Aug 2017 20:24:46 -0700 Subject: [PATCH] Add completeAndInvalidate to CADisplayLink --- Source/CADisplayLink+LambdaKit.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Source/CADisplayLink+LambdaKit.swift b/Source/CADisplayLink+LambdaKit.swift index 0b414ee..b816e9b 100644 --- a/Source/CADisplayLink+LambdaKit.swift +++ b/Source/CADisplayLink+LambdaKit.swift @@ -51,6 +51,12 @@ extension CADisplayLink { } } + /// Invalidates the current CADisplayLink but calling the handler one more time with progress = 1.0. + public func completeAndInvalidate() { + self.closureWrapper?.handler(1.0) + self.invalidate() + } + /// Creates a DisplayLink and add it to the main run loop. The displayLink will execute for the given /// duration in seconds. ///