Search code examples
swiftvariablesswiftuiprivate

Is there any disadvantage of marking a variable or constant as private in terms of performance or something?


Is there any disadvantage in terms if performance or something by marking a variable as a private on a class or struct on Swift or view on SwiftUI?

I know about the encapsulation advantage you get when the variable is private, preventing access from other code outside the scope. My concern is about performance.


Solution

  • I can say (Flutter experience) it won't slow down your code or app. Its just usable from this one file... but you mentioned that earlier in your question.

    But no this won't make your app slower.