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

Add DisplayLinkClock for iOS, tvOS, and macOS #170

Merged

Conversation

kevincianfarini
Copy link
Contributor

This commit adds two imlementations of a MonotonicFrameClock
backed by CADisplayLink on iOS and tvOS and CVDisplayLink
on macOS.

watchOS does not have an equivalent that I'm aware of and therefore
has been omitted.

@kevincianfarini
Copy link
Contributor Author

@JakeWharton this PR is ready for a real review now. One thing to note -- The current darwinTest sourceset only runs tests on macos targets. Adding the quartzCoreTest sourceset to darwinTest once the iOS simulator stuff is sorted should be all that's needed to test this.

@JakeWharton
Copy link
Member

To anyone watching this from the outside (because I keep linking it to people), we are going to merge, but are in the process of adding unit tests for iOS and tvOS.

@swankjesse
Copy link

FYI, I borrowed some of this for Redwood.
cashapp/redwood#990

Comment on lines +28 to +31
private val displayLink: CADisplayLink = CADisplayLink.displayLinkWithTarget(
target = this,
selector = NSSelectorFromString(this::tickClock.name),
)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm looking at this again months later and this doesn't need a variable. It can just be in an init block 🤦

This commit adds two imlementations of a `MonotonicFrameClock`
backed by `CADisplayLink` on iOS and tvOS and `CVDisplayLink`
on macOS.

watchOS does not have an equivalent that I'm aware of and therefore
has been omitted.
@JakeWharton JakeWharton force-pushed the kcianfarini/display-link-clock branch from fb72f01 to 76d653e Compare May 23, 2023 19:49
@JakeWharton JakeWharton enabled auto-merge (squash) May 23, 2023 19:49
@JakeWharton JakeWharton force-pushed the kcianfarini/display-link-clock branch from 76d653e to 14390c0 Compare May 23, 2023 19:56
@JakeWharton JakeWharton disabled auto-merge May 23, 2023 20:01
@JakeWharton JakeWharton enabled auto-merge (squash) May 23, 2023 20:05
@JakeWharton JakeWharton merged commit 7b6bb17 into cashapp:trunk May 23, 2023
1 check passed
@kevincianfarini
Copy link
Contributor Author

Woohoo! Thanks for getting this over the finish line, Jake.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants