我对SwiftUI还是很陌生,但是遇到了一个令人沮丧的错误:一旦我向左滑动任何List行以对其进行编辑,所有行都会向右稍移。
Here is a demonstration of the bug: https://imgur.com/a/lxCszSV, and here is a minimal code example:
var body: some View {
List {
ForEach(0 ..< followedArtists.count, id: \.self) {i in
FollowedArtistResult(name: self.followedArtists[i].name!, image_data: self.followedArtists[i].image_data)
}
.onDelete(perform: unfollowArtist)
}
}
The same problem appears if I replace FollowedArtistResult
in the ForEach with a simple Text
view. Moreover, navigating to another view and coming back resets it to the original position.
Does anyone know what's going on?