Better Programming

Advice for programmers.

Follow publication

Member-only story

Create a SwiftUI Clock That Counts Down to WWDC 2022

Millie Dev
Better Programming
Published in
3 min readJun 3, 2022
Screenshot by the author

First I’m going to recreate the Apple logo as a SwiftUI path. To make it easy to draw the path I’ve created an object that automatically creates all of the necessary points.

It is created by passing the maxX and maxY values of the frame it is being drawn in, as all of the points are drawn in relation to those maximum values.

These points were chosen as estimates by me, so you may disagree about how the overall shape turns out.

If you want to move any points in the shape you can do that here, making sure to multiply by maxX or maxY to get a relative position rather than a hard-coded one. The shape can be any size, so a fixed position would potentially be outside of the frame and would not scale.

Multiplying by the max in either direction makes a value of 1 equal to that maximum.

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Millie Dev
Millie Dev

Written by Millie Dev

An iOS developer who writes about gadgets, startups and blockchains. Swift programming tutorials are at typesafely.co.Uk

No responses yet

Write a response