Code Monkey home page Code Monkey logo

timeline's Introduction

Timeline

Timeline like the Path iOS app

Usage

The timeline is a UIView subclass, and can be taller than the screen. It is best used within a scrollview.

To initialize the timeline, use this code:

let timeline = TimelineView(bulletType: .Diamond, timeFrames: [/*timeFrames*/])

The bullet type can be changed to any of the following types:

public enum BulletType{
	case Circle
	case Hexagon
	case Diamond
	case DiamondSlash
	case Carrot
	case Arrow
}

The time frames must all be instances of the TimeFrame stuct. An array of TimeFrames may look like this:

let frames = [
	TimeFrame(text: "New Year's Day", date: "January 1", image: UIImage(named: "fireworks.jpeg")),
	TimeFrame(text: "That's right. No image is necessary!", date: "No image?", image: nil),
	TimeFrame(text: "Hope this helps someone!", date: "That's it!", image: nil)
]

After the timeline is initialized, it is ready to go. For more customization, you can edit the following properties:

public var timeFrames: [TimeFrame]
  
public var lineColor: UIColor = UIColor.lightGrayColor()
	
public var titleLabelColor: UIColor = UIColor(red: 0/255, green: 180/255, blue: 160/255, alpha: 1)

public var detailLabelColor: UIColor = UIColor(red: 110/255, green: 110/255, blue: 110/255, alpha: 1)

public var bulletType: BulletType = BulletType.Diamond

public var showBulletOnRight: Bool = false

For more precise detail on what these properties do, look at the inline documentation.

At this point, the timeline is completely ready to use. Add it to a scroll view, add constraints, and you are ready to go!

See the sample project for an example of how to do integrate this view into your project.

Conclusion

That's about all there is to it! Hope you find it useful, and let me know if you use it in any production apps. It's great to see my work used by others.

timeline's People

Contributors

edekhayser avatar yonat avatar pawankmrai avatar bryant1410 avatar

Watchers

James Cloos avatar Nicolas Tran avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.