Avatar
@swift-5.2.5 -O struct Container { var value: Any = "foo" func withValue(action: (Any) -> Void) { action(value) } } var container = Container() container.withValue { value in print(value) container.value = "bar" print(value) } (edited)