A
A
Anton Frolov2015-09-13 11:33:40
Objective-C
Anton Frolov, 2015-09-13 11:33:40

Why does the function conflict?

There are two functions with the same name and different set of parameters.
At the same time, they have a conflict:
99b3afda58ce4c2a85d5791078a19ebe.png
I broke my head - I can’t understand how this can be? Help, please, to understand.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
ManWithBear, 2015-09-13
@ManWithBear

In short: ObjC does not support method overloading, so you must use different names for methods.
1) Just rename the second method.
2) (If this is still UIViewController) Move the application logic from its controller to the model. Accordingly, create a class that will perform all calculations and not inherit anything from ObjC.
PSTherefore, I believe that learning swift without objc is useless. You still have to write with objc logic, only swift words.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question