Does Swift have access modifiers?

In Objective-C instance data can be public, protected or private. For example:

@interface Foo : NSObject
{
  @public
    int x;
  @protected:
    int y;
  @private:
    int z;
  }
-(int) apple;
-(int) pear;
-(int) banana;
@end

I haven’t found any mention of access modifiers in the Swift reference. Is it possible to limit the visibility of data in Swift?

16 Answers
16

Leave a Comment