KSTimeline, written in swift, is a simple and customizable view which supports showing a series of events in a vertically time-sorted structure.
- adjust the time scale by pinch gesture
- display different time mode according to time scale
- play next event automatically
- scroll to seek video
- press > to next video
- press < to previous video
@objc public protocol KSTimelineDelegate: NSObjectProtocol {
func timelineStartScroll(_ timeline: KSTimelineView)
func timelineEndScroll(_ timeline: KSTimelineView)
func timeline(_ timeline: KSTimelineView, didScrollTo date: Date)
}
@objc public protocol KSTimelineDatasource: NSObjectProtocol {
func numberOfEvents(_ timeline: KSTimelineView) -> Int
func event(_ timeline: KSTimelineView, at index: Int) -> KSTimelineEvent
}
@objc public class KSTimelineEvent: NSObject {
public var start: Date
public var end: Date
public var duration: Double
public var videoURL: URL
public init(start: Date, end: Date, duration: Double, videoURL: URL) {
self.start = start
self.end = end
self.duration = duration
self.videoURL = videoURL
super.init()
}
}
KSTimeline can be added to your project using CocoaPods by adding the following line to your Podfile
:
pod 'KSTimeline'