What kind of user input? Please explain a little bit more, what you want to do.
Post
Replies
Boosts
Views
Activity
@mohamedfromparis: I'm sorry, I read it too fast! I don't know, what you want to achieve exactly. What will be before the text? Line breaks? If not, what will happen if you type in your text and then create a new line? Will your TextEditor resize?
Last year I started a bigger project with Catalyst, because I didn't want to write code twice (as some controls didn't exist at this time, so I had to rely on UIKit... therefore I didn't want to write code with UIKit and AppKit to support both). This year now there are some more controls, but still you cannot build an app 100 % with SwiftUI, unfortunately. I'm still thinking about how I will do this now, if I should continue using Catalyst or switch to the Multiplatform template.
Are there any official longterm plans? I think if Apple is now pushing the iOS frameworks to macOS and if now the design of macOS is getting closer to iOS/iPadOS, there will be hopefully in the end no need for Catalyst anymore?
You can:
struct ContentView: View {
		@State var text: String = ""
var body: some View {
		TextEditor(text: self.$text)
		.multilineTextAlignment(.center)
}
}
Setting the focus/firstResponder on a control improves the user experience and is in my eyes absolutely essential. I expected that SwiftUI will support this from now on. Very disappointing, that it doesn't do it. But there is some time until the final release and I hope that Apple will listen to our wishes. I would be very happy if SwiftUI would support it. Would be nice to do something like this:
struct ContentView: View {
@Environment(\.firstResponder) private var firstResponder: ObjectIdentifier
@State var text1: String = ""
@State var text2: String = ""
var body: some View {
VStack {
TextField("...", text: self.$text1)
.id("TF1")
TextField("...", text: self.$text2)
.id("TF2")
HStack {
Button("Focus 1") {
self.firstResponder = "TF1"
}
Button("Focus 2") {
self.firstResponder = "TF2"
}
}
}
}
}