diff --git a/MVMCoreUI/Organisms/Carousel.swift b/MVMCoreUI/Organisms/Carousel.swift index b9847487..94c47f4b 100644 --- a/MVMCoreUI/Organisms/Carousel.swift +++ b/MVMCoreUI/Organisms/Carousel.swift @@ -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)