2

If you select a file in the Files app on iOS you can tap on the title and get some extra actions, similar to a context menu. I want this in one of my apps and learned about the toolbarTitleMenu modifier. However if I add a ShareLink and tap on it, nothing happens.

Here's an example:

struct ContentView: View {
    var body: some View {
        NavigationStack {
            Text("Example Content")
                .toolbarTitleMenu {
                    ShareLink(item: "test share content") // Here, nothing happens
                }
                .navigationTitle("Test Title")
                .navigationBarTitleDisplayMode(.inline)
            ShareLink(item: "test share content") // Here it works
        }
    }
}

enter image description here

What am I doing wrong?

iOS 17.2.1

4
  • Yet another SwiftUI bug. This used to not work, then it got fixed in iOS 16.1, and now it apparently broke again. stackoverflow.com/q/73424912/5133585 Commented Dec 31, 2023 at 15:48
  • Thanks, but that's a different problem that got fixed indeed an still works as expected. Commented Jan 1, 2024 at 16:11
  • Experiencing the same issue, have you found a solution? Commented Jan 4, 2024 at 0:35
  • No, for now I'm not using the ShareLink in the toolbarTitleMenu modifier. I will file a bug report later. Please upvote. Commented Jan 4, 2024 at 13:48

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.