Swift 3: The difference between Public and Internal access modifiers?

前端 未结 6 1757
孤独总比滥情好
孤独总比滥情好 2020-12-15 09:16

I read the Apple\'s reference about access modifiers in Swift 3. I read also about the same on stackoverflow but I didn\'t get an answer as the person who asked. As I unders

6条回答
  •  不思量自难忘°
    2020-12-15 10:05

    •   Public - Can be used from any module but can’t be subclassed outside defining module (target).
    
    •   Internal - This is default access modifier in swift. Can be accessible from the defining module (target) only.
    
    •   Open - Can be used from any module and can be subclassed outside defining module (target).
    
    •   Swift 4+
    
    •   Fileprivate - Fileprivate members and functions are accessible within the same file, within the extension in same file, and extension in other file also.

    
    •   Private - Private members and functions are accessible within the same file, within the extension in same file.
    

提交回复
热议问题