I have a random integer that needs to update every second, but my issue is that the random int cannot be defined outside of a function because it is an random int with the range of 0 to the screen size
var randomX = UInt32(self.size.width)
I cannot use self.size.width outside of a function. At first I thought maybe its not updating because its 1. Declared in the function didMoveToView() and 2. I declared it using "let" instead of "var". If I declare it in my function that updates every second, the variable cannot be used outside of that function which is a huge problem.
Aucun commentaire:
Enregistrer un commentaire