All Projects → instant-solutions → Istimeline

instant-solutions / Istimeline

Licence: apache-2.0
Simple timeline view written in Swift 3

Programming Languages

swift
15916 projects
swift3
66 projects

Projects that are alternatives of or similar to Istimeline

Bfkit Swift
BFKit-Swift is a collection of useful classes, structs and extensions to develop Apps faster.
Stars: ✭ 963 (-4.18%)
Mutual labels:  cocoapods, carthage
Grview
UIView and other UIKit elements with a gradient and other attributes for IOS
Stars: ✭ 39 (-96.12%)
Mutual labels:  cocoapods, carthage
Tbactionsheet
A Custom&Powerful Action Sheet For iOS. 一个 ActionSheet 满足所有样式!超高自由度的可定制!
Stars: ✭ 942 (-6.27%)
Mutual labels:  cocoapods, carthage
Centeredcollectionview
A lightweight UICollectionViewLayout that 'pages' and centers its cells 🎡 written in Swift
Stars: ✭ 965 (-3.98%)
Mutual labels:  cocoapods, carthage
Swiftysound
SwiftySound is a simple library that lets you play sounds with a single line of code.
Stars: ✭ 995 (-1%)
Mutual labels:  cocoapods, carthage
Imagescout
A Swift implementation of fastimage. Supports PNG, GIF, and JPEG.
Stars: ✭ 940 (-6.47%)
Mutual labels:  cocoapods, carthage
Swiftlyext
SwiftlyExt is a collection of useful extensions for Swift 3 standard classes and types 🚀
Stars: ✭ 31 (-96.92%)
Mutual labels:  cocoapods, carthage
Imgix Swift
A Swift client library for generating URLs with imgix
Stars: ✭ 19 (-98.11%)
Mutual labels:  cocoapods, carthage
Avsqldebugger
A Simple Core Data Debugger that will look inside your apps DB
Stars: ✭ 30 (-97.01%)
Mutual labels:  cocoapods, carthage
Ctpanoramaview
A library that displays spherical or cylindrical panoramas with touch or motion based controls.
Stars: ✭ 951 (-5.37%)
Mutual labels:  cocoapods, carthage
Mixpanel Iphone
iPhone tracking library for Mixpanel Analytics
Stars: ✭ 939 (-6.57%)
Mutual labels:  cocoapods, carthage
Sketchkit
A lightweight auto-layout DSL library for iOS & tvOS.
Stars: ✭ 40 (-96.02%)
Mutual labels:  cocoapods, carthage
Cascadingtabledelegate
A no-nonsense way to write cleaner UITableViewDelegate and UITableViewDataSource in Swift.
Stars: ✭ 931 (-7.36%)
Mutual labels:  cocoapods, carthage
Sica
🦌 Simple Interface Core Animation. Run type-safe animation sequencially or parallelly
Stars: ✭ 980 (-2.49%)
Mutual labels:  cocoapods, carthage
Swipemenuviewcontroller
Swipable tab and menu View and ViewController.
Stars: ✭ 926 (-7.86%)
Mutual labels:  cocoapods, carthage
Tkswitchercollection
An animation switch collection
Stars: ✭ 877 (-12.74%)
Mutual labels:  cocoapods, carthage
Sdwebimageflplugin
A SDWebImage plugin to support GIF using FLAnimatedImage and category
Stars: ✭ 16 (-98.41%)
Mutual labels:  cocoapods, carthage
Preferences
⚙ Add a preferences window to your macOS app in minutes
Stars: ✭ 898 (-10.65%)
Mutual labels:  cocoapods, carthage
Quiver
Validation, searching and filtering made easy for swift.
Stars: ✭ 27 (-97.31%)
Mutual labels:  cocoapods, carthage
Fontblaster
Programmatically load custom fonts into your iOS and tvOS app.
Stars: ✭ 1,000 (-0.5%)
Mutual labels:  cocoapods, carthage

ISTimeline

ISTimeline is a simple timeline view written in Swift 3

Latest release CocoaPods Carthage compatible License

ISTimeline

Requirements

  • iOS 8.0 or higher
  • Swift 3

Installation

CocoaPods

ISTimeline is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'ISTimeline'

Carthage

ISTimeline is also available through Carthage. Include the following line into your Cartfile and follow the instructions under getting started:

github "instant-solutions/ISTimeline"

Manually

Just drop the files ISPoint.swift and ISTimeline.swift into your project.

Usage

Import

import ISTimeline

Integration

We recommend to use the timeline view in your storyboard. Just add a plain view and set the custom class and the module property to ISTimeline.

Custom class

Or add the view programmatically:

let frame = CGRect(x: 0.0, y: 20.0, width: 300.0, height: 400.0)

let timeline = ISTimeline(frame: frame)
timeline.backgroundColor = .white

self.view.addSubview(timeline)

ISPoint

Each bubble is represented by an ISPoint object in the points array. ISPoints has several properties:
var title:String shown in the bubble
var description:String? shown below the bubble
var pointColor:UIColor the color of each point in the line
var lineColor:UIColor the color of the line after a point
var touchUpInside:Optional<(_ point:ISPoint) -> Void> a callback, which is triggered after a touch inside a bubble
var fill:Bool fills the point in the line (default: false)

Example point:

let point = ISPoint(title: "my title")
point.description = "my awesome description"
point.lineColor = .red
point.fill = true

Initializers

The designated initializer is:

ISPoint(title:String, description:String, pointColor:UIColor, lineColor:UIColor, touchUpInside:Optional<(_ point:ISPoint) -> Void>, fill:Bool)

You also can use one the convenience initializers:

ISPoint(title:String, description:String, touchUpInside:Optional<(_ point:ISPoint) -> Void>)
ISPoint(title:String, touchUpInside:Optional<(_ point:ISPoint) -> Void>)

Or even this one:

ISPoint(title:String)

Touch events

To get touch events you just have to set a callback closure to the property point.touchUpInside. It is triggered after a touch up inside a bubble.

point.touchUpInside =
  { (point:ISPoint) in
    // do something
}

Add points to the timeline

To add points to the timeline you can simple create and set your points array to the property timeline.points or you can append each point one after the other.

let myPoints = [
  ISPoint(title: "first"),
  ISPoint(title: "second"),
  ISPoint(title: "third")
]
timeline.points = myPoints

Append a single point:

timeline.points.append(ISPoint(title: "fourth"))

Colors

You can customize the following timeline colors:
var bubbleColor:UIColor color of every bubble (default .init(red: 0.75, green: 0.75, blue: 0.75, alpha: 1.0))
var titleColor:UIColor color of the title in the bubble (default .white)
var descriptionColor:UIColor color the description text (default .gray)
Points can be colored as described above.

Line width and point radius

Some common parameters can be adjusted:
var pointDiameter:CGFloat diameter of a point in the line (default 6.0)
var lineWidth:CGFloat the thickness of the line (default 2.0)
var bubbleRadius:CGFloat the radius of the bubble corners (default 2.0)

Bubble arrows

With the flag var bubbleArrows:Bool it is possible to remove all arrows (default true).
With arrows:
Bubble with arrow

And without arrows:
Bubble without arrow

Intents

You can add some padding by setting the content insets. This currently can only be done programmatically.

timeline.contentInset = UIEdgeInsetsMake(20.0, 20.0, 20.0, 20.0)

Clip subviews

Per default, the timeline clips all subviews to its bounds. If you would like to change this behavior just set it to false.

timeline.clipsToBounds = false

Working example

let frame = CGRect(x: 0.0, y: 20.0, width: 300.0, height: 400.0)
let timeline = ISTimeline(frame: frame)
timeline.backgroundColor = .white
timeline.bubbleColor = .init(red: 0.95, green: 0.95, blue: 0.95, alpha: 1.0)
timeline.titleColor = .black
timeline.descriptionColor = .darkText
timeline.pointDiameter = 7.0
timeline.lineWidth = 2.0
timeline.bubbleRadius = 0.0

self.view.addSubview(timeline)

for i in 0...9 {
    let point = ISPoint(title: "point \(i)")
    point.description = "my awesome description"
    point.lineColor = i % 2 == 0 ? .red : .green
    point.pointColor = point.lineColor
    point.touchUpInside =
        { (point:ISPoint) in
            print(point.title)
    }

    timeline.points.append(point)
}

Demo

ISTimelineDemo is a simple demo app which shows the usage of ISTimeline in a storyboard.

TODOs

  • [ ] show images in the timeline
  • [ ] animate the appending and removing of an entry

License

ISTimeline is licensed under the terms of the Apache License 2.0. See the LICENSE file for more info.

Contribution

Feel free to fork the project and send us a pull-request! 😎

Or consider sponsoring us so we can continue to work on this project: GitHub Sponsors :star_struck:

Author

Made with ❤️ in Austria by instant:solutions OG

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].