How to make memberwise initializer public by default for structs in Swift?
Hello everyone! I started learning Swift and encountered a problem when working with structs. By default, Swift generates a memberwise initializer for structs, which allows you to create an instance by passing values for all properties. But if I declare a struct with `public` access level, the memberwise initializer becomes internal, not public. Because of this, I cannot use the struct from another module.
Here's an example:
```swift
// ModuleA.swift
public struct User {
public let name: String
public let age: Int
// memberwise initializer is not declared explicitly
}
// ModuleB.swift (another module)
let user = User(name: "Alice", age: 30) // Error: 'User' cannot be initialized with memberwise initializer
```
I