List Inside Scrollview Is Not Displayed on Watchos

Content in scrollview as a list item disappears when scrolling (swiftui), why?

If I correctly understood what disappears (I assume you meant list rows on vertical scrolling), then yes it is due to List reuse/cache optimisation issue.

The following approach should work (tested with Xcode 11.2 / iOS 13.2)

struct ItemView: View {
var body: some View {
VStack {
Text("Tag list:")
ScrollView(.horizontal, showsIndicators: false) {
HStack {
ForEach(0...8, id: \.self) { _ in
TagView().padding()
}
}
}.id(UUID().uuidString) // << here is a fix !
}
}
}

WatchOS ScrollView Doesn't Wrap Text Properly

Define .lineLimit(x) to what you want to be the maximum of line the Text is able to expand. Then add .fixedSize(horizontal: false, vertical: true) to secure that the size is not shrinking back due the SwiftUI layout engine. See below.

struct ContentView: View {
var body: some View {
// Watch res = 448 - 368
ScrollView(.vertical) {
VStack(spacing: 10){
Text("Your News").font(.title)
ForEach(0..<articles.count) {index in
Text(articles[index].title)
Text(articles[index].body)
.lineLimit(nil)
.multilineTextAlignment(.leading)
.fixedSize(horizontal: false, vertical: true)
// Text(articles[index].body).lineLimit(50).padding(EdgeInsets(top: 0, leading: 10, bottom: 0, trailing: 10))
// Height needs to be variable based on the amount of text in the
// articles description. OR find a wrapper
// We're talking about the frame for the body of text
}
}
}
}
}

Scroll whole screen height (watchOS)

Right now there is no any possibility to make padded scrolls, looks like apple used for it closed API..

As for me, worked chose to use dummy picker and animate changing (hiding and uhhiding) of WKInterfaceGroups, whose height equals to screen height by rolling digital crown)



Related Topics



Leave a reply



Submit