How to store elements visible on screen into a list while scrolling
Scenario:
Scrolling through a list of songs in Playlist, I am able to store only elements visible on screen. Could you please help me on storing elements into a list while scrolling
Here’s some pseudocode to get you going. If you have duplicated songs you may need to check more than one element. It’s a clear use case for recursion:
main
initialize list
initialize finalList
screen is presented
list = getElements
finalList = getAllElements(list)
end
getAllElements(list)
initialize myList = list
initialize iterateList
scroll
iterateList = getElements
if iterateList.last == myList.last
return myList
else
myList += iterateList
iterateList.clear
getAllElements(myList)
end
end