RGTimeline
RGTimeline is a custom timeline control written in Swift for displaying 'events'.
Event: Anything that can be represented with a start and end date. E.g video files, calendar entries etc.
The original idea for this project came from KSTimeline, however this solution only provided support for one days worth of 'events'. I wrote this solution from the ground up to support infinte amounts of time.
How to get started
- Install via Cocoapods
platform :ios, '11.0'
# You need to set target when you use CocoaPods 1.0.0 or later.
target 'SampleTarget' do
use_frameworks!
pod 'RGTimeline'
end
- Download from source and build the RGTimeline framework in Release
Usage
Swift
import RGTimeline
Example
@IBAction weak var timelineView: TimelineView!
private func render()
{
//TEST DATA: TIMES IN GMT
//Friday, 1 June 2018 22:08:47 - Friday, 8 June 2018 22:08:47
//Saturday, 9 June 2018 00:20:04 - Saturday, 9 June 2018 06:20:04
//Tuesday, 26 June 2018 09:00:00 - Tuesday, 26 June 2018 09:04:36
let firstEvent = (Date(timeIntervalSince1970: 1527890927)...Date(timeIntervalSince1970: 1528495727))
let secondEvent = (Date(timeIntervalSince1970: 1528503604)...Date(timeIntervalSince1970: 1528525204))
let thirdEvent = (Date(timeIntervalSince1970: 1530003600)...Date(timeIntervalSince1970: 1530003876))
//To render in the default device timezone.
self.timelineView.render([firstEvent, secondEvent, thirdEvent])
//To render in a chosen timezone.
self.timelineView.render([firstEvent, secondEvent, thirdEvent], timezone: TimeZone(identifier: "Europe/London")!)
}
Objective-C
@import RGTimeline
Features
Endless and infinite
Render as much or as little as you'd like.
Robust and smart
Optimised for rendering large numbers of 'events' without taking a performance hit. Smart 'event' clustering also means the memory footprint is kept low.
Timezone and Daylight Savings Time support
Render 'event's in any timezone you choose and Daylight Savings Time transitions will be reflected.
6 levels of granularity
The timeline will render from years all the way down to seconds so 'events' are easy to visualise and navigating to the precise second is easy.
Fully customisable UI
Change the colours and show/hide features instantly at runtime. Also supported in Interface Builder.
Requirements
The current version of RGTimeline requires:
- Xcode 10 or later
- Swift 4.2 or later
- iOS 11 or later
Author
License
- RGTimeline is available under the MIT license. See the LICENSE file.