Created
February 1, 2018 23:56
-
-
Save williamhjcho/b48bf4504b33c039bf394f2493c03f2a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Test { | |
func a() { | |
b() | |
c() // can access if in same file (fileprivate) | |
d() // same (private) | |
e() // same (private extension) | |
f() // same (private extension and private method) | |
} | |
} | |
extension Test { | |
func b() { | |
f() // can access even if it's extension is also private | |
} | |
fileprivate func c() {} | |
private func d() {} | |
} | |
private extension Test { | |
func e() { | |
d() // can access while it's still private | |
} | |
private func f() {} | |
// gives a warning when defining fileprivate func within private extension | |
//fileprivate func g() {} | |
} | |
// In another file | |
let test = Test() | |
test.a() | |
test.b() | |
//test.c() // can't access | |
//test.d() // can't access | |
test.e() | |
//test.f() // can't access |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment