0

I want to automatically scroll down lists in swiftui when running the app. For example, like this How to make a SwiftUI List scroll automatically?

I've created the app by reference to this. But I got a bug. Like attached screenshot.. enter image description here

I tried to fix it but I couldn't find a method that can solve this. Somebody help please Thanks

enter image description here

Miah G.
  • 129
  • 1
  • 7
  • No, I just created the app by reference it because I want the same feature like this. but it doesn't work for me. If you know about that, please help me.Thanks – Miah G. May 21 '20 at 22:10
  • https://www.process-one.net/blog/writing-a-custom-scroll-view-with-swiftui-in-a-chat-application/ you should read this it may help you,, you need to spicific what is that input? – Abdullah Bahattab May 21 '20 at 22:15
  • I already read it. but it's scroll with static values. hm.. I'm creating chat view now.So if user type text, it should go up. That's the same action as clicking Add button. What's solution for this? – Miah G. May 21 '20 at 22:31
  • you faced precondtion failure: invaled input index:2 I think you should read this https://stackoverflow.com/questions/58304009/how-to-debug-precondition-failure-in-xcode – Abdullah Bahattab May 21 '20 at 22:36
  • Hi Abdullah Bahattab, thanks for answer. I saw it but I don't understand well with that. I attached more screenshot for my code on my posting. please let me know what is wrong.Thanks – Miah G. May 21 '20 at 22:43
  • your bug failure index:2 does not aim to one reason so its hard to figure it out. may there is a problem to hieght or width with listview... try to decrease it. – Abdullah Bahattab May 21 '20 at 23:10
  • In my first screenshot the bug disappears when remove .modifier(ViewHeightKey()). of course all function of the app don't works normally. I think the reason of this bug is what it's in .modifier(ViewHeightKey()). Here is code for that. extension ViewHeightKey: ViewModifier { func body(content: Content) -> some View { return content.background(GeometryReader { proxy in Color.clear.preference(key: ViewHeightKey.self, value: proxy.size.height) }) } } how is it? what's wrong? – Miah G. May 21 '20 at 23:33
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/214378/discussion-between-anna-s-and-abdullah-bahattab). – Miah G. May 21 '20 at 23:51

0 Answers0