Skip to content

Commit 6b22055

Browse files
author
Martin Conte Mac Donell
committed
Return cadisplaylink on operation
1 parent d16c3c2 commit 6b22055

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

LambdaKit.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'LambdaKit'
3-
s.version = '0.0.4'
3+
s.version = '0.1.0'
44
s.license = 'MIT'
55
s.summary = 'Closures on most used UIKit methods'
66
s.homepage = 'https://github.com/Reflejo/LambdaKit'

Source/CADisplayLink+LambdaKit.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,20 @@ extension CADisplayLink {
5656
///
5757
/// - parameter duration: The duration in seconds.
5858
/// - parameter handler: The closure to execute for every tick.
59-
public class func runFor(_ duration: CFTimeInterval, handler: @escaping LKDisplayLinkClosure) {
59+
public static func runFor(_ duration: CFTimeInterval,
60+
handler: @escaping LKDisplayLinkClosure) -> CADisplayLink
61+
{
6062
let displayLink = CADisplayLink(target: self, selector: #selector(CADisplayLink.tick(_:)))
6163

6264
displayLink.closureWrapper = ClosuresWrapper(handler: handler, duration: duration)
6365
displayLink.add(to: RunLoop.main, forMode: RunLoopMode.defaultRunLoopMode)
66+
return displayLink
6467
}
6568

6669
// MARK: Private methods
6770

6871
@objc
69-
private class func tick(_ displayLink: CADisplayLink) {
72+
private static func tick(_ displayLink: CADisplayLink) {
7073
guard let closureWrapper = displayLink.closureWrapper else {
7174
return
7275
}

0 commit comments

Comments
 (0)