Pro tip 1: Don’t use legacy Objective-C functions CGRectGetMinX() and CGRectGetMaxX() in Swift code; use gameArea.minX and gameArea.maxX which are equivalent but modern and Swifty.
Pro tip 2: Always start variable names with a lowercase letter, so dino instead of Dino. Breaking this naming convention can really confuse experienced Swift programmers trying to read the code.
btw im just following a video so please dumb it down for me
Pro tip 3: Be wary of any tutorial or video (on any programming topic) that’s more than a few years old. They often don’t age well. Yours appears to be one that is almost 8 years old. It looks pretty good overall (after just glancing over a couple of the episodes) but as you can see the actual APIs have evolved since then.
BTW, another forum user was working off the same video and already performed some of this modernization. See this thread.
And to answer the actual original question: arc4random() indeed doesn’t take any arguments. Why is that there? The video uses a function called random() which is defined elsewhere in the code. And (no surprise) the API for generating pseudo-random numbers has evolved since then anyway.
Topic:
App & System Services
SubTopic:
General
Tags: