I was trying to understand how parameters work in Swift and thus wrote a simple class as follows
class NumberIncreaser { func numberIncrementor(var number:Int)->Int{ number += 1 return number } var anotherNumber = numberIncrementor(3) } However even after explicitly mentioning that the method 'numberIncrementor' takes an Int , Xcode asks for a numberIncreaser object(hope I am using the correct terminology , new to programming) instead. I noticed that when I remove the class the method works perfectly fine. I would like to know why this is so and how can I resolve it.
Thanks!
class. You need to do that in scope ofmethodsorglobalscope.