Post

Replies

Boosts

Views

Activity

Reply to Text right-to-left direction with mathematical text
ok, this looks a bit better. I now do it only on operations and stuff the result into a HStack: HStack { ForEach(elements) { item in textFromElement(element: item).flipsForRightToLeftLayoutDirection(item.type == .OPERATION) } } } The result looks a bit nearer to what I want: Now I have to make a distinction between operators that have to be mirrored (parentheses, arithmetic operatiors...) and operators that show arabic text and hve to stay how they are.... I am not sure if that really is the best solution, but it may produce some acceptable result in the end.
Topic: UI Frameworks SubTopic: SwiftUI
Oct ’24
Reply to Text right-to-left direction with mathematical text
Ah well, found something... I had to explicitly add .flipsForRightToLeftLayoutDirection(true) to the "baked" Text at the end. That is func makeText(stuff) -> Text { result: Text = Text("") + Text(number) - Text(op) + ... + Text(...) return result ... GridRow { makeText(stuff).font(...).flipsForRightToLeftLayoutDirection(true) ... and the result looks different. now two consecutive Text items in arabic are put in the wrong order and arabic text and numbers are going the wrong way. So this is mainly useful for mirroring, with the parentheses and such
Topic: UI Frameworks SubTopic: SwiftUI
Oct ’24
Reply to iOS 18, XCode 16, SwiftUI display HTML resource file
Solved it. It turns out, WKWebKit not only does not need to be wrapped in a ScrollView, it apparently does not work in a ScrollView, and (more or less) does not work only when wrapped in a ScrollView. I put every other tab in a ScrollView before, so did the same with this one. When I simply add it in a VStack instead, it displays fine.
Topic: UI Frameworks SubTopic: SwiftUI
Oct ’24