Skip to content

georgel/KSTimeline

 
 

Repository files navigation

KSTimeline

KSTimeline, written in swift, is a simple and customizable view which supports showing a series of events in a vertically time-sorted structure.

Preview

Demo1

  • adjust the time scale by pinch gesture
  • display different time mode according to time scale

Demo2

  • play next event automatically
  • scroll to seek video
  • press > to next video
  • press < to previous video

Usage

Delegate

@objc public protocol KSTimelineDelegate: NSObjectProtocol {
    
    func timelineStartScroll(_ timeline: KSTimelineView)
    
    func timelineEndScroll(_ timeline: KSTimelineView)
    
    func timeline(_ timeline: KSTimelineView, didScrollTo date: Date)
    
}

Datasource

@objc public protocol KSTimelineDatasource: NSObjectProtocol {
    
    func numberOfEvents(_ timeline: KSTimelineView) -> Int
    
    func event(_ timeline: KSTimelineView, at index: Int) -> KSTimelineEvent
    
}

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()
        
    }
        
}

Installation

Cocoapods

KSTimeline can be added to your project using CocoaPods by adding the following line to your Podfile:

pod 'KSTimeline'

About

Simple custom timeline written in swift

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 97.3%
  • Ruby 1.5%
  • Objective-C 1.2%