When upgrade from swift3 to swift4, I have this error: Value of type ImageSlideshow?
has no member pageControlBottomPadding
I use xcode10.1, swift4, target ios9.0 and above. ImageSlideshow
version is 1.7.0.
There are also warnings: 'pageControl' is deprecated: Use pageIndicator.view instead
I think it might because the member name changed in swift4, the pageControl and its members are no longer used, and tried changing pageControl
to pageIndicator
or pageIndicator.view
,
But I searched and cannot find the corresponding member name of currentPageIndicatorTintColor
and pageIndicatorTintColor
and pageControlBottomPadding
Here's my code:
import ImageSlideshow
...
@IBOutlet weak var imageSliderView: ImageSlideshow!
...
imageSliderView.pageControl.currentPageIndicatorTintColor = Color.Laser.instance()
imageSliderView.pageControl.pageIndicatorTintColor = UIColor.white
imageSliderView.pageControlBottomPadding = 30.0
Any idea what new name should I use? Or is there a way I can still use "pageControl" in swift4? Thank you very much.
pageControl
is deprecated in the latest version of ImageSlideshow.
The example from the library's github indicates that you should use pageControl
like below. This will also get your deprecated warnings fixed:
@IBOutlet var slideshow: ImageSlideshow!
let pageControl = UIPageControl()
pageControl.currentPageIndicatorTintColor = UIColor.lightGray
pageControl.pageIndicatorTintColor = UIColor.black
slideshow.pageIndicator = pageControl
To fix the error, use the following:
slideshow.pageIndicatorPosition = .init(horizontal: .center, vertical: .customBottom(padding: 30))