Skip to content

Instantly share code, notes, and snippets.

@SarahAlsharif
Created August 16, 2020 13:27
Show Gist options
  • Save SarahAlsharif/e46a8f0f74baefa54fce40ce632c37e6 to your computer and use it in GitHub Desktop.
Save SarahAlsharif/e46a8f0f74baefa54fce40ce632c37e6 to your computer and use it in GitHub Desktop.
.onReceive(timer) { (_) in
if !self.gameOver {
self.changeDirection()
if self.posArray[0] == self.foodPos {
self.posArray.append(self.posArray[0])
self.foodPos = self.changeRectPos()
}
}
}
.edgesIgnoringSafeArea(.all)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment