skip to Main Content

In iOS 18, textSelection(_:) not working in List. So, I can’t copy text. Works on iOS 17 and earlier. 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)
    }
}

2

Answers


  1. Chosen as BEST ANSWER

    In iOS 18.1, textSelection(_:) works in List!

    struct ContentView: View {
        var body: some View {
            List {
                Text("Hello World")
                    .textSelection(.enabled)
            }
        }
    }
    

    image


  2. Have you tried on real device in iOS18 it looks still working on my device. If you tried this in simulator, try to use real device

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search