Is it necessary to declare a property for a private variable?

I just wanted to know if it is necessary to declare a property for every private variable I create in my Xcode projects. If it is, can someone explain me the reason? Thanks =)

Upvotes: 0

Views: 93

Answers (1)

Kevin DiTraglia
Kevin DiTraglia

Reputation: 26058

Properties are useful if you want to add custom get-and-set logic for your variables. They typically are used more for public variables. There are certainly cases when you may want to also use them for private variables, but it is not "necessary".

Upvotes: 1

Related Questions