extension UIScrollView {
func scrollPositionY(view:UIView) -> CGFloat {
if let origin = view.superview {
// Get the Y position of your child view
let childStartPoint = origin.convert(view.frame.origin, to: self)
let this = childStartPoint.y
return this
}
}
}
and then
let theYvalue = theScrollView.scrollPositionY
theYvalue
is of type (UIView) -> CGFloat
Can I convert this to a CGFloat?
Thank you!