🔰Access Control

circle-check
circle-info

5 個層級,最高到最低依次為:

  • open / public / internal / file-private / private

fileprivate

circle-info

The only reason you would use fileprivate is when you want to access your code within the same file from different classes or structs. 👉 SwfitLee

// fileprivate setter
fileprivate(set) var a = 1

private

circle-info

extensions have to be defined within the same file, private declarations are not visible outside the file.

Last updated