SwiftUI: .textSelection(.enabled) not working in List on iOS 18

In iOS 18, textSelection(_:) not working in List. So, I can't copy text. Works on iOS 17 and earlier. Is this a bug and is there any solution?

// Not Work: iOS 18
struct ContentView: View {
    var body: some View {
        List {
            Text("Hello World")
                .textSelection(.enabled)
        }
    }
}

// Work: iOS 18 and earlier
struct ContentView: View {
    var body: some View {
        Text("Hello World")
            .textSelection(.enabled)
    }
}
Answered by donchan922 in 811461022

In iOS 18.1, textSelection(_:) works in List! https://stackoverflow.com/a/79135453/11073133

Ran into this as well. Filed FB15178192 to track with a simple repro case similar to the one above.

temporary workaround to use https://github.com/jayrhynas/EditMenu

Accepted Answer

In iOS 18.1, textSelection(_:) works in List! https://stackoverflow.com/a/79135453/11073133

SwiftUI: .textSelection(.enabled) not working in List on iOS 18
 
 
Q