DroidsOnRoids / SwiftCarousel

Lightweight, written natively in Swift, circular UIScrollView.
http://www.thedroidsonroids.com/blog/ios/circular-scroll-view-swiftcarousel/
MIT License
144 stars 43 forks source link

Items factory #14

Closed sunshinejr closed 8 years ago

sunshinejr commented 8 years ago

Hey guys! 🎉 So I had some time and tried to repair #11 with improving copying method and adding new method that takes closure and itemsCount as parameters instead of static views. I'd love if you could check this out @aocenas and @irodrigo17 to check if everything is now clear on your part. You can use development pod or:

pod 'SwiftCarousel', :head

Thanks! Log from the PR:

aocenas commented 8 years ago

Hi, I have tested the code, the copy method works as expected. I see I was mistaken when I wrote that problem was with copyView being shallow, now with the copy of constrains everything is fine.

Also using the itemsFactory is without problem and very easy change in my code. Good work.

sunshinejr commented 8 years ago

Perfect! itemsFactory is just another way of specifying items, you still can do it by init or by property .items, but we have to be aware that only one should be used for the setup, not both. Thanks for checking it out! 🎉

irodrigo17 commented 8 years ago

@sunshinejr Ok, just tested this on my project and if I use the itemsFactory and always return a new view there it works great, thanks a lot!

I think my previous comment about adding a note to the docs as a warning for the copyView implementation detail still applies to the case when you init the carousel using the items property instead of the itemsFactory closure.