lundi 11 janvier 2016

Why does swift provide both a CGRect initializer and a CGRectMake function?

When I was learning about Core Graphics in swift, the tutorials that I watched on youtube use the CGRectMake function instead of the initializer of CGRect to create a CGRect instance.

This is so weird to me. I don't understand why should I use the former because the parameters are the same and I think there is no performance benefit to using the XXXMake function.

Also, why does swift even have such a "Make" function, when CGRect already has an initializer with exactly the same parameters? I think the developers of the modules is using a certain design pattern that I don't know. Did they use one? If yes, what is it? I really want to know some more design patterns.

Aucun commentaire:

Enregistrer un commentaire