Swift 3: Difference between Public and Internal access modifiers?

I read the Apple link about access modifiers in Swift 3. I also read about the same in stackoverflow, but I did not get the answer as the person who asked. As I understood correctly, there are four levels:

  • Open, Publish
  • Interior
  • Fileprivate
  • Private

I created circuits for myself to understand the difference between all of these modifiers and download here . As you can see, the differences between the Public and Internal modifiers do not differ. However, they are at different levels. Any idea would be appreciated!

+7
source share
5 answers

, , . . .

Intenal: , - . .

: - . - , , .

Private: , , , . , , .

1. - ( ) , - ( ) .

2.Open :

3. , .

4. , . , , , , .

5. , , , , .

+13

.

A.swift B.swift C.swift D.swift. , ( open.

+2

, , (). - , (). (), , .

+6

Swift Programming Language Apple :

"Swift . , , , .

, , . . .

, . .

. , , .

. , ,

: Apple Inc. " Swift (Swift 3.1)". . https://itun.es/gb/jEUH0.l "

+6
  • - swift. - - ().

  • Public - - . .

  • - , , ,

  • Fileprivate - , - - .

  • - , .

0

Source: https://habr.com/ru/post/1015884/


All Articles