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
Adding Drop Shadow to Table View Cell
How to Change an Inout Parameter from Within a Escaping Closure
Animate UIlabel Width with Fixed Center
Wrong Image Orientation After Displaytransform Call
Core Data with Swiftui Mvvm Feedback
Swift: Get The Compile Time Name of Variable (Referencing to a Class)
Swift Preserve UIswitch State on UIlongpress
How Do Uniqueness Constraints as (Comma,Separated,Attributes) Work with Swift in Coredata
Swift 4: How to Asynchronously Use Urlsessiondatatask But Have The Requests Be in a Timed Queue
How to Pass Data from Using Post/Form Leaf Template
Understanding Optional Global Variables in Swift
Applying Impulses in Spritekit
Swift Casting Generic to Optional with a Nil Value Causes Fatalerror
<Unknown>:0: Error: Opening Import File for Module 'swift': Not a Directory
Addperiodictimeobserver Is Not Called Every Millisecond
Swiftui Previews - Unexpected Data