Giter VIP home page Giter VIP logo

swiftuiscrollviewupdatebug's Introduction

I've filed a Feedback with Apple for this issue: FB8101550

Bug Description and Steps to Reproduce

Create a very simple app that uses a ScrollView() as the main component in a View’s body. Have that ScrollView()’s items come from a ForEach() block that iterates over an array, either @State or a @Published array in an @ObservedObject. Update that array in .onAppear() (or via anything else, e.g. network request that updates a @Published property).

Expected behaviour: The app should immediately update with objects 1 through 5 on launch. Actual behaviour: The app doesn’t update until you tap on the screen, and then it updates.

Workarounds

There are a few different workarounds I've seen to fix this:

  1. If the ScrollView() is in a VStack() the problem doesn't happen.
  2. If there is a Rectangle() view of negligible height in the ScrollView(), the bug doesn't happen and it updates immediately.
  3. If the array that the ForEach iterates over starts off with an oject in it instead of empty, the bug doesn't happen and it updates immediately.

swiftuiscrollviewupdatebug's People

Watchers

Jeremy Gale avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.