Draw a line in Spritekit

Hey CodeCrew,

I am looking to make another SpriteKit game and have for a while now had my eye on something like the video I am gonna include. Does anyone know how that line is drawn. I can figure out the physics and the ball. But the line has me.

If anyone can help that would be awesome.

Rebound Game


This post from Stackoverflow might be of assistance.

These tuts are super old, and not quite what I need. Is there something more relevent that I can’t find on google. Swift and SpriteKit has changed so much in the last 5 years.

If anyone knows the code to draw a line with TOUCH like in my example video then that would be great. The line should be straight, can be angled, but always straight and should disapear upon touching with the ball. And the line should also be any length the user sets with his touch.

Have a look at this project that Paul Hudson describes. Its Day 77 of 100 Days Of Swift in which he creates a game where you draw lines on the screen as part of hitting a target. When you lift your finger off, the lines disappear.