Multiline Text not possible in accessoryRectangular widget on lock screen

Filed as FB20766506

I have a very simple use case for a rectangular widget on the iPhone lock screen: One Text element which should fill as much space as possible. However, it only ever does 2 per default and then eclipses the rest of the string.

Three separate Text elements work fine, so does a fixedSize modifier hack (with that even four lines are possible!). Am I completely misunderstanding something or why is this not possible per default? Other apps' widgets like Health do it as well.

My attempt (background added for emphasis)

Health app widget

var body: some View {
        VStack(alignment: .leading) {
            /// This should span three lines, but only spans 2 which eclipsed text.
            Text("This is a very long text which should span multiple lines.")
            //    .fixedSize(horizontal: false, vertical: true) /// Using this fixes it as well, but that does not seem like a good default solution.
            
            /// Three separate `Text` elements work fine.
            //  Text("This is a very long")
            //  Text("text which should")
            //  Text("span multiple lines.")
        }
        .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .leading)
        .background(Color.black) /// Added for emphasis of the widget frame
    }

Thanks for the post and the bug report for your widget. It seems like you just filed it. Please give some time to the engineering team.

You can see the status of your feedback in Feedback Assistant. There, you can track if the report is still being investigated, has a potential identifiable fix, or has been resolved in another way. The status appears beside the label "Resolution." We're unable to share any updates on specific reports on the forums.

For more details on when you'll see updates to your report, please see What to expect after submission.

Albert Pascual
  Worldwide Developer Relations.

Multiline Text not possible in accessoryRectangular widget on lock screen
 
 
Q