AMClockView
is a view can select time.
Create clockView.
let clockView = AMClockView(frame: view.bounds)
// customize here
clockView.delegate = self
view.addSubview(clockView)
Conform to the protocol in the class implementation.
func clockView(_ clockView: AMClockView, didChangeDate date: Date) {
// use selected date here
}
The hour hand moves when you dragged inside of central circle.
The minute hand moves when you draged outside of central circle.
AMClockView
can be customized via the following properties.
@IBInspectable public var clockBorderLineWidth: CGFloat = 5.0
@IBInspectable public var smallClockIndexWidth: CGFloat = 1.0
@IBInspectable public var clockIndexWidth: CGFloat = 2.0
@IBInspectable public var hourHandWidth: CGFloat = 5.0
@IBInspectable public var minuteHandWidth: CGFloat = 3.0
@IBInspectable public var clockBorderLineColor: UIColor = .black
@IBInspectable public var centerCircleLineColor: UIColor = .darkGray
@IBInspectable public var hourHandColor: UIColor = .black
@IBInspectable public var minuteHandColor: UIColor = .black
@IBInspectable public var selectedTimeLabelTextColor: UIColor = .black
@IBInspectable public var timeLabelTextColor: UIColor = .black
@IBInspectable public var smallClockIndexColor: UIColor = .black
@IBInspectable public var clockIndexColor: UIColor = .black
@IBInspectable public var clockColor: UIColor = .clear
@IBInspectable public var clockImage: UIImage?
@IBInspectable public var minuteHandImage: UIImage?
@IBInspectable public var hourHandImage: UIImage?
@IBInspectable public var isShowSelectedTime: Bool = false
public var clockType = AMCVClockType.arabic
public var timeZone: TimeZone? // default is TimeZone.current
public var selectedDate: Date?
Add this to your Podfile.
pod 'AMClockView'
Add this to your Cartfile.
github "adventam10/AMClockView"
MIT