Closure: Escaping

#@escaping

Overview

Keeps the data in memory for use later on.

Subjects

Sample Codes

init(location: Location, onSave: @escaping (Location) -> Void) {  // escape says to swift stay alive the memory we will call that later on
    self.location = location
    self.onSave = onSave

    _name = State(initialValue: location.name)
    _description = State(initialValue: location.description)
}

...

Sources

Videos

Articles / Documents

See also

Last updated