Open rebink opened 5 years ago
can you please share for which circumstance code did not work?
it is not working with swift 5 can you please update this code
// // RoundedCornerView.swift // DSC // // Created by Mohamed Rebin on 26/08/19. // Copyright © 2019 Rebin. All rights reserved. //
import UIKit
@IBDesignable class RoundedCornerView: UIView {
var cornerRadiusValue : CGFloat = 0 var corners : UIRectCorner = [] @IBInspectable public var cornerRadiusForSelectedSide : CGFloat { get { return cornerRadiusValue } set { cornerRadiusValue = newValue } } override func draw(_ rect: CGRect) { super.draw(rect) if topLeft { corners.insert(.topLeft) } if topRight { corners.insert(.topRight) } if bottomLeft { corners.insert(.bottomLeft) } if bottomRight { corners.insert(.bottomRight) } self.roundCorners(corners: corners, radius: cornerRadiusForSelectedSide) } @IBInspectable public var topLeft : Bool { get { return corners.contains(.topLeft) } set { setCorner(newValue: newValue, for: .topLeft) } } @IBInspectable public var topRight : Bool { get { return corners.contains(.topRight) } set { setCorner(newValue: newValue, for: .topRight) } } @IBInspectable public var bottomLeft : Bool { get { return corners.contains(.bottomLeft) } set { setCorner(newValue: newValue, for: .bottomLeft) } } @IBInspectable public var bottomRight : Bool { get { return corners.contains(.bottomRight) } set { setCorner(newValue: newValue, for: .bottomRight) } } func setCorner(newValue: Bool, for corner: UIRectCorner) { if newValue { addRectCorner(corner: corner) } else { removeRectCorner(corner: corner) } } func addRectCorner(corner: UIRectCorner) { corners.insert(corner) } func removeRectCorner(corner: UIRectCorner) { if corners.contains(corner) { corners.remove(corner) } }
// // func updateCorners() { // self.roundCorners(corners: corners, radius: cornerRadiusValue) // }
}
this code is not working for me Error: - Value of type 'RoundedCornerView' has no member 'roundCorners'
// // RoundedCornerView.swift // DSC // // Created by Mohamed Rebin on 26/08/19. // Copyright © 2019 Rebin. All rights reserved. //
import UIKit
@IBDesignable class RoundedCornerView: UIView {
// // func updateCorners() { // self.roundCorners(corners: corners, radius: cornerRadiusValue) // }
}