Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
11
Task/Break-OO-privacy/Swift/break-oo-privacy.swift
Normal file
11
Task/Break-OO-privacy/Swift/break-oo-privacy.swift
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
struct Example {
|
||||
var notSoSecret = "Hello!"
|
||||
private var secret = 42
|
||||
}
|
||||
|
||||
let e = Example()
|
||||
let mirror = Mirror(reflecting: e)
|
||||
|
||||
if let secret = mirror.children.filter({ $0.label == "secret" }).first?.value {
|
||||
print("Value of the secret is \(secret)")
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue