I’m try to make a app from this book, but then i copy and paste, i got this here error: “Type ‘Float’ has no member ‘random’”
Page 65
I’m useing: Xcode Version 9.1 (9B55)
I’m try to make a app from this book, but then i copy and paste, i got this here error: “Type ‘Float’ has no member ‘random’”
Page 65
I’m useing: Xcode Version 9.1 (9B55)
Hi @007fred50 , I believe random function is defined in Float+Extensions.swift file which is included in GameUtils folder. Have you included that folder in your project?
I see @007fred50. Could you check if the Float extension and the random function are both defined public in your Float extension file?
sorry, i don’t understand that you say.
That looks fine. I think it should work. Just to check if your compilation error is due to something else what you can do is copy the Float extension defined in Float extension file and paste it on top of the file where you are getting the compilation error. Also you need to comment the extension defined here in order to avoid duplication. The compilation error for random function should go away with that.
Hi, Does the problem go away if you copy & paste the Float extension in your GameViewController class where you are getting compilation error?
Ok. I think the problem could be the way you added GameUtils folder into your project. So when you dragged and dropped the GameUtils folder into your project, did you choose Copy items if needed as well as create groups option? One option would be to delete the reference of that folder from your project and try to add again with options selected: Copy items if needed and create groups.
In your video it shows that while dropping the GameUtils folder into your project you had selected Copy items if needed and Create folder references. What happens if you choose options: 1. Copy items if needed 2. Create groups.
This topic was automatically closed after 166 days. New replies are no longer allowed.