diff --git a/Sources/Filters.swift b/Sources/Filters.swift index 042f9be..ccb113d 100644 --- a/Sources/Filters.swift +++ b/Sources/Filters.swift @@ -60,7 +60,7 @@ class MetaballFilter : CIFilter { guard let inputImage = inputImage else { return nil } // color - var image = CIFilter(name: "CIColorControls", parameters: [kCIInputBrightnessKey: 1, kCIInputSaturationKey: 0, kCIInputContrastKey: 0, kCIInputImageKey: inputImage])?.outputImage + var image = CIFilter(name: "CIColorControls", withInputParameters: [kCIInputBrightnessKey: 1, kCIInputSaturationKey: 0, kCIInputContrastKey: 0, kCIInputImageKey: inputImage])?.outputImage // blur image = image?.applyingGaussianBlur(sigma: Double(blurRadius)) diff --git a/Sources/Slider.swift b/Sources/Slider.swift index 08f47ce..b94caa3 100644 --- a/Sources/Slider.swift +++ b/Sources/Slider.swift @@ -258,19 +258,19 @@ open class Slider : UIControl { private func layoutBackgroundImage() { let inset = UIEdgeInsets(top: min(0, shadowOffset.height - shadowBlur), left: min(0, shadowOffset.width - shadowBlur), bottom: max(0, shadowOffset.height + shadowBlur) * -1, right: max(0, shadowOffset.width + shadowBlur) * -1) - backgroundImageView.frame = self.bounds.inset(by: inset) + backgroundImageView.frame = UIEdgeInsetsInsetRect(self.bounds, inset) backgroundImageView.image = UIGraphicsImageRenderer(bounds: backgroundImageView.bounds).image(actions: { context in if let color = shadowColor { context.cgContext.setShadow(offset: shadowOffset, blur: shadowBlur, color: color.cgColor) } contentViewColor?.setFill() let inset = UIEdgeInsets(top: inset.top * -1, left: inset.left * -1, bottom: inset.bottom * -1, right: inset.right * -1) - UIBezierPath(roundedRect: backgroundImageView.bounds.inset(by: inset), cornerRadius: contentViewCornerRadius).fill() + UIBezierPath(roundedRect: UIEdgeInsetsInsetRect(backgroundImageView.bounds, inset), cornerRadius: contentViewCornerRadius).fill() }) } private func layoutValueView() { - let bounds = self.contentView.bounds.inset(by: UIEdgeInsets(top: 0, left: valueViewMargin, bottom: 0, right: valueViewMargin)) + let bounds = UIEdgeInsetsInsetRect(self.contentView.bounds, UIEdgeInsets(top: 0, left: valueViewMargin, bottom: 0, right: valueViewMargin)) let centerX = fraction * bounds.size.width + bounds.minX setValueViewPositionX(to: centerX) } @@ -319,7 +319,7 @@ open class Slider : UIControl { } private func boundsForValueViewCenter() -> CGRect { - return bounds.inset(by: UIEdgeInsets(top: 0, left: valueViewMargin - ValueView.kLayoutMarginInset + valueView.bounds.midX, bottom: 0, right: valueViewMargin - ValueView.kLayoutMarginInset + valueView.bounds.midX)) + return UIEdgeInsetsInsetRect(bounds, UIEdgeInsets(top: 0, left: valueViewMargin - ValueView.kLayoutMarginInset + valueView.bounds.midX, bottom: 0, right: valueViewMargin - ValueView.kLayoutMarginInset + valueView.bounds.midX)) } private func fractionForPositionX(_ x: CGFloat) -> CGFloat {