What are the differences between :
I am getting error, where I have two init methods.
convenience init() and
Error is : ‘self’ used before super.init call
I have write
super.init(), then also no luck. Please let me know about above methods.
I’m kinda new to Swift, but from what I understand, the convenience init() is used to provide alternate constructors to your class, so you get different ways of creating your instances. Your convenience declaration has to be different from any other init() you might already have.
For example, a CGPoint can be instanciated with no params, ‘x’ and ‘y’ as CGFloats, as doubles, ints, etc. Behind the scenes, I’m pretty sure they do the exact same thing, but the different param types let you create a CGPoint without having to typecast.
hope it helps a little!