I ended up doing this which worked, but I still want to know why the original way doesn't work.
import SwiftUI
public struct ExpandingTextFieldView: View {
@Binding var text: String
let placeholder: String
public init(
text: Binding<String>,
placeholder: String = "Enter your text here..."
) {
self._text = text
self.placeholder = placeholder
}
public var body: some View {
TextField(placeholder, text: $text, axis: .vertical)
}
}