Q-Mobile / QGrid

🎛 QGrid: The missing SwiftUI collection view.
MIT License
1.64k stars 104 forks source link

Add the option to specify scroll direction #23

Open ruangchupa opened 4 years ago

ruangchupa commented 4 years ago

Added scrollDirection parameter which defines the direction of scrolling behaviour. If not provided, the vertical scrolling behaviour will be used.

karolkulesza commented 4 years ago

Hi there,

Thanks for contributing! However, when I tried to verify this feature by specifying scrollDirection in QGridTestApp's PeopleView (as .horizontal), the app was freezing at launch, with the following CPU report:

Screenshot 2020-01-26 at 13 06 17

Are you able to address it on QGridTestApp side as well? I wouldn't like to merge/publish something which does not work in the test app.

ruangchupa commented 4 years ago

@karolkulesza Hey there, thanks for the review. Anyway, I couldn't reproduce the problem you've described. According to my experiments, the CPU usage always normal on the test app. Could you tell me the Xcode version you're using? I'm using the latest version of Xcode.

However, I added another commit to remove default block on the switch case statement as it will never be executed.

karolkulesza commented 4 years ago

Thanks. Could you also please explain what is the purpose of such feature assuming the current implementation of the sample PeopleView? After specifying scrollDirection as .horizontal the grid still grows vertically, not horizontally, as the number of columns is fixed. The only outcome for the test app is that there are now horizontal scroll indicators.

Alternatively, could you please provide the full use case for this feature? (With a sample code using QGrid with .horizontal scrollDirection)