Skip to content

Commit 3aa00e4

Browse files
author
Martin Conte Mac Donell
committed
Add completeAndInvalidate to CADisplayLink
1 parent 994d931 commit 3aa00e4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Source/CADisplayLink+LambdaKit.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ extension CADisplayLink {
5151
}
5252
}
5353

54+
/// Invalidates the current CADisplayLink but calling the handler one more time with progress = 1.0.
55+
public func completeAndInvalidate() {
56+
self.closureWrapper?.handler(1.0)
57+
self.invalidate()
58+
}
59+
5460
/// Creates a DisplayLink and add it to the main run loop. The displayLink will execute for the given
5561
/// duration in seconds.
5662
///

0 commit comments

Comments
 (0)