How to set a custom font for accessoryInline iOS 16 Lock Screen widgets?

701 Views Asked by At

I want to set a custom font for inline widget text. I put the custom font to the accessory Rectangular and it's working well however, I am not able to set the font to the accessory Inline widget.

Here I attached an image of the custom font for lock screen inline widgets that I am trying to achieve.

enter image description here

here is my code

func widgetView(for data: MyModel) -> some View {
    switch family {
    case .accessoryInline:
        Text(data.message)
            .font(Font.custom("Belmist-Regular", size: 18))
            .foregroundColor(.primary)
    default:
        Text("Unsuported family.")
    }
}
1

There are 1 best solutions below

0
Boon On

From my experience, you cannot set the font or font size on the accessory inline widget. In my case, I tried to set the font size to be like 4 pt but it still renders at default font size.

In addition, I tried to use HStack to join multiple pieces of texts and I couldn't do that either. Need to use text concatenation.

It seems to me that we only allow to use unedited text plus some icons from SF symbol.