Skip to main content
←API Reference ←NSDK ←Nsdk_Vps_LocalizationUpdate

with


Declaration​

static func with(_ populator: (inout Self) throws -> Void) rethrows -> Self

Summary​

Creates an instance of the message type on which this method is called,
executes the given block passing the message in as its sole inout
argument, and then returns the message.
This method acts essentially as a "builder" in that the initialization of
the message is captured within the block, allowing the returned value to
be set in an immutable variable. For example,
let msg = MyMessage.with { $0.myField = "foo" }
msg.myOtherField = 5 // error: msg is immutable

Returns​

The message after execution of the block.

Parameters​

NameTypeSummary
populator ( Self) throws -> Void
A block or function that populates the new message,
which is passed into the block as an inout argument.