struct X {
public var a
public var b
public var c
init(a: Int = 0, b: Int = 0, c: Int = 0)
{
self.a = a
self.b = b
self.c = c
}
}
let x = X(a: 5)
let y = X(a:5, b:3)
let z = X(c:3, a: -1, b: 0)
or something similar. X is a struct, not a closure. It has to be initialized.
That'd be defaulting them to zero (depending on the system/compiler). As of SE-0242, it should be relatively easy to do for Swift struct though I don't know how it'd work with C struct.
For your example, it looks like you want to copy vk into a constant appInfo translating arbitrary fields during the copy. Is this the case? If it can be done, I think it's going to need to use reflection (the Mirror protocols) and a lot of tricky coding. I don't think it's an "out-of-the-box" thing. Or, a lot of specialized init methods.
Also, you are showing a C-struct, not a Swift struct. Assuming you named your Swift struct equivalent the same, you could do:
var appInfo = vk.ApplicationInfo // instance vk has a field 'ApplicationInfo'
appInfo.applicationName = "Hello Triangle"
appInfo.applicationVersion = 1
The downside is that ```appInfo`` is no longer a non-mutable constant.