Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes Foundation's delay to wait #624

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions C4/Core/Foundation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ public func CGRectMakeFromPoints(points: [CGPoint]) -> CGRect {
///
/// - parameter delay: The amount of time in seconds to wait before executing the block of code.
/// - parameter action: A block of code to perform after the delay.
public func delay(delay: Double, action: ()->()) {
public func wait(seconds: Double, action: ()->()) {
dispatch_after(
dispatch_time(
DISPATCH_TIME_NOW,
Int64(delay * Double(NSEC_PER_SEC))
Int64(seconds * Double(NSEC_PER_SEC))
),
dispatch_get_main_queue(), action)
}
2 changes: 1 addition & 1 deletion C4/UI/ScreenRecorder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class ScreenRecorder: NSObject, RPPreviewViewControllerDelegate {

public func start(duration: Double) {
start()
delay(duration) {
wait(duration) {
self.stop()
}
}
Expand Down
2 changes: 1 addition & 1 deletion C4/UI/ViewAnimation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public class ViewAnimation: Animation {
let disable = ShapeLayer.disableActions
ShapeLayer.disableActions = false

C4.delay(delay) {
wait(delay) {
if let spring = self.spring {
self.animateWithSpring(spring)
} else {
Expand Down