Post

Replies

Boosts

Views

Activity

How to make a scrollable multi-line Text
As you can see, I'm really struggling to create a simple multi-line Text. The closest I got so far is putting it in a List instead of a ScrollView, but then I get a line under the text.Any help would be greatly appreciated 🙂/// This was the most obvious approach struct Try1 : View { var body: some View { ScrollView { Text(content) } } } /// OK, I probably need to let it wrap to multiple lines. struct Try2 : View { var body: some View { ScrollView { Text(content) .lineLimit(nil) } } } /// Hmm no dice. /// Maybe if I tell it to use the parent's size? struct Try3 : View { var body: some View { ScrollView { Text(content) .relativeWidth(1.0) } } } /// Nope. /// Maybe it needs to be a "fixed" size? struct Try4 : View { var body: some View { ScrollView { Text(content) .lineLimit(nil) .fixedSize(horizontal: true, vertical: false) } } } /// The other way? struct Try5 : View { var body: some View { ScrollView { Text(content) .lineLimit(nil) .fixedSize(horizontal: false, vertical: true) } } } /// Nope struct Try6 : View { var body: some View { ScrollView { Text(content) .relativeWidth(1.0) }.relativeWidth(1.0) } } /// Still no text wrapping struct Try7 : View { var body: some View { ScrollView { VStack { Text(content) Spacer() } } } } /// This wraps the text correctly, but then draws an unsighly horizontal line right below it :( struct Try8 : View { var body: some View { List { Text(content) .lineLimit(nil) } } }
13
0
14k
Jun ’19
How to render HDR content on iOS
I notice that when I open the Photos app on my iPhone 12 Pro, viewing Photos or Videos shot in HDR makes them brighter than the overall display brightness level. On macOS, there are APIs like EDRMetadata on CAMetalLayer and maximumExtendedDynamicRangeColorComponentValue on NSScreen. I did see CAMetalLayer.wantsExtendedDynamicRangeContent, but I'm not sure if this does what I'm looking for. The "Using Color Spaces to Display HDR Content" - https://developer.apple.com/documentation/metal/drawable_objects/displaying_hdr_content_in_a_metal_layer/using_color_spaces_to_display_hdr_content?language=objc documentation page describes setting the .colorspace on the CAMetalLayer for BT2020_PQ content, but it's not clear if this is referring to macOS or iOS. Is that the right way to get colors to be "brighter" than 1.0 on "XDR" mobile displays?
6
0
3.6k
Oct ’20