implemented feedback

This commit is contained in:
Khan, Arshad 2020-03-13 01:55:58 +05:30
parent bd4450a7fc
commit 73230fa341

View File

@ -13,7 +13,7 @@ open class Carousel: View {
public let collectionView = UICollectionView(frame: CGRect(x: 0, y: 0, width: MVMCoreUISplitViewController.getDetailViewWidth(), height: 300), collectionViewLayout: UICollectionViewFlowLayout())
/// The current index of the collection view. Includes dummy cells when looping.
var currentIndex = 0
public var currentIndex = 0
/// The index of the page, does not include dummy cells.
public var pageIndex: Int {
@ -114,7 +114,6 @@ open class Carousel: View {
layout.scrollDirection = .horizontal
layout.minimumLineSpacing = CGFloat(carouselModel?.spacing ?? 1)
layout.minimumInteritemSpacing = 0
layout.itemSize = CGSize(width: MVMCoreUISplitViewController.getDetailViewWidth(), height: 300)
collectionView.collectionViewLayout = layout
}
@ -184,19 +183,19 @@ open class Carousel: View {
pagingView?.removeFromSuperview()
guard let pagingView = view else {
bottomPin?.isActive = false
bottomPin = bottomAnchor.constraint(equalTo: collectionView.bottomAnchor)
bottomPin = safeAreaLayoutGuide.bottomAnchor.constraint(equalTo: collectionView.bottomAnchor)
bottomPin?.isActive = true
return
}
pagingView.translatesAutoresizingMaskIntoConstraints = false
addSubview(pagingView)
pagingView.centerXAnchor.constraint(equalTo: collectionView.centerXAnchor).isActive = true
collectionView.bottomAnchor.constraint(equalTo: pagingView.topAnchor, constant: position).isActive = true
bottomAnchor.constraint(greaterThanOrEqualTo: pagingView.bottomAnchor).isActive = true
collectionView.bottomAnchor.constraint(equalTo: pagingView.bottomAnchor, constant: position).isActive = true
safeAreaLayoutGuide.bottomAnchor.constraint(greaterThanOrEqualTo: pagingView.bottomAnchor).isActive = true
bottomPin?.isActive = false
bottomPin = bottomAnchor.constraint(equalTo: collectionView.bottomAnchor)
bottomPin = safeAreaLayoutGuide.bottomAnchor.constraint(equalTo: collectionView.bottomAnchor)
bottomPin?.priority = .defaultLow
bottomPin?.isActive = false
bottomPin?.isActive = true
pagingView.setNumberOfPages(numberOfPages)
(pagingView as? MVMCoreUIViewConstrainingProtocol)?.alignHorizontal?(.fill)