Git Product home page Git Product logo

timelinetableviewcell's Introduction

TimelineTableViewCell

TimelineTableViewCell is a simple timeline view implemented by UITableViewCell. The UI design of TimelineTableViewCell is inspired by ISTimeline.

GitHub stars GitHub forks CocoaPods Compatible Platform GitHub license

TimelineTableViewCell TimelineTableViewCell

Requirements

  • iOS 9.0 or higher

v1.0.1-

  • Swift 3

v1.2-

  • Swift 4

v1.3

  • Swift 5

v2.0+

  • Breaking Changes for v1.3-: thumbnailImageView is replaced with UIStackView to support multiple thumbnails.
  • Do not support iOS9.0- anymore.

Installation

Swift Package Manager

The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift compiler.

Once you have your Swift package set up, adding TimelineTableViewCell as a dependency is as easy as adding it to the dependencies value of your Package.swift.

dependencies: [
    .package(url: "https://github.com/kf99916/TimelineTableViewCell.git")
]

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate TimelineTableViewCell into your Xcode project using CocoaPods, specify it in your Podfile:

pod 'TimelineTableViewCell'

Usage

Import

import TimelineTableViewCell

Integration

Register Nib

let bundle = Bundle(for: TimelineTableViewCell.self)
let nibUrl = bundle.url(forResource: "TimelineTableViewCell", withExtension: "bundle")
let timelineTableViewCellNib = UINib(nibName: "TimelineTableViewCell",
	bundle: Bundle(url: nibUrl!)!)
tableView.register(timelineTableViewCellNib, forCellReuseIdentifier: "TimelineTableViewCell")

Dequeue

let cell = tableView.dequeueReusableCell(withIdentifier: "TimelineTableViewCell",
	for: indexPath) as! TimelineTableViewCell

// Configure TimelineTableViewCell...

TimelinePoint

The point in line is represented by a TimelinePoint object.
var diameter: CGFloat the diameter of a point in the line (default 6.0)
var lineWidth: CGFloat the thickness of the point (default 2.0)
var color: UIColor the color of each point in the line (default UIColor.black)
var isFilled: Bool fills the point in the line (default false)

Initializers

TimelinePoint(diameter: CGFloat, lineWidth: CGFloat, color: UIColor, filled: Bool)
TimelinePoint(diameter: CGFloat, color: UIColor, filled: Bool)
TimelinePoint(color: UIColor, filled: Bool)
TimelinePoint()

Timeline

The line in the cell is represented by a Timeline object and is divided by the point as the front line and the backline.
var width: CGFloat the thickness of the line (default 2.0)
var frontColor: UIColor the color of the front line (defalut UIColor.black)
var backColor: UIColor the color of the back line (defalut UIColor.black)
var leftMargin: CGFloat the left margin of the line (default 60.0)

Initializers

Timeline(width: CGFloat, frontColor: UIColor, backColor: UIColor)
Timeline(frontColor: UIColor, backColor: UIColor)
Timeline()

TimelineTableViewCell

The cell is represented by a TimelineTableViewCell object.
titleLabel: UILabel! the title in the bubble
descriptionLabel: UILabel! the description
lineInfoLabel: UILabel! the information about line
thumbnailImageView: UIImageView! the thumbnail illustrationImageView: UIImageView! the illustration
var bubbleRadius: CGFloat the radius of the bubble corners (default 2.0)
var bubbleColor: UIColor the color of every bubble (default .init(red: 0.75, green: 0.75, blue: 0.75, alpha: 1.0)) viewsInStackView: [UIView] the views in the stack view. var bubbleEnabled: Bool Enable draw bubble (default true)

Apps using TimelineTableViewCell

If you are using TimelineTableViewCell in your app and want to be listed here, simply create a pull request.

I am always curious who is using my projects :)

Hikingbook - by Zheng-Xiang Ke

Hikingbook

Demo

TimelineTableViewCellDemo is a simple demo app which shows the usage of TimelineTableViewCell in a storyboard.

Author

Zheng-Xiang Ke, [email protected]

License

TimelineTableViewCell is available under the MIT license. See the LICENSE file for more info.

timelinetableviewcell's People

Contributors

dendim0n avatar kf99916 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

timelinetableviewcell's Issues

allow leftMargin to change

lets change protection level of attribute named 'leftMargin' internal to public, in order to make change x index of vertical line.

Customize TimeLineTableViewCell

Hi, thanks first of all for the library. I wanted to ask you if there's a way to customise the cell in the way i will show you in the attached pic. I just want to relocate the description and title, and also add an image in between the timeline and the written text.
Screenshot 2020-05-16 at 17 26 40

How can I customize cell?

I want to customize the custom cell. For example, I want to add a location icon and location label in some cells. Also, I need a button in every cells. Can you help?

Fatal error: Can't form Range with upperBound < lowerBound

When running my app on smaller screens (iPod, iPhone SE, etc.) the pod crashes in TimelineTableViewCell.swift at line 101 with the fatal error:

Thread 1: Fatal error: Can't form Range with upperBound < lowerBound file Swift/x86_64-apple-ios-simulator.swiftinterface, line 14814

This is the code starting from line 101.

let views = viewsInStackView.count <= maxNumSubviews ? viewsInStackView : Array(viewsInStackView[0..<maxNumSubviews]) views.forEach { view in view.translatesAutoresizingMaskIntoConstraints = false view.addConstraint(NSLayoutConstraint(item: view, attribute: NSLayoutConstraint.Attribute.width, relatedBy: NSLayoutConstraint.Relation.equal, toItem: view, attribute: NSLayoutConstraint.Attribute.height, multiplier: 1, constant: 0)) view.contentMode = .scaleAspectFill view.clipsToBounds = true stackView.addArrangedSubview(view) }

viewsInStackView at this stage are 0, while the maxNumSubviews are -1. Hence the crash.

This is only seen on some devices, not all. Hence it is difficult to spot or reproduce. I have seen this on some iPhone 5s, iPhone SE and iPod Touch (7th Gen) so far.

Need a resolution really soon as many of my users can't use my app anymore.

Could not load NIB in bundle

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle </Users/irfanpule/Library/Developer/CoreSimulator/Devices/77500ABE-FA84-4DF7-A658-0AC1E134A454/data/Containers/Bundle/Application/CCA3C281-0E57-4313-8B0E-95B53C6D0276/xxxxxx.app/Frameworks/TimelineTableViewCell.framework> (loaded)' with name 'TimelineTableViewCell''

I am using Xcode 11, Swift 5

maxNumSubviews == -1

Not sure how to reproduce this, but for some reason maxNumSubviews ends up being -1, which causes a crash in TimelineTableViewCell on this line:

let views = viewsInStackView.count <= maxNumSubviews ? viewsInStackView : Array(viewsInStackView[0..<maxNumSubviews])

Just curious if anyone else has had this problem?
I'm working on a fork on my end, so it may be caused by that. However refactoring this line to be a bit cleaner couldn't hurt

The Module is not loading through swift package manager

I have used as you said.

let bundle = Bundle(for: TimelineTableViewCell.self)
let nibUrl = bundle.url(forResource: "TimelineTableViewCell", withExtension: "bundle")
let timelineTableViewCellNib = UINib(nibName: "TimelineTableViewCell",
bundle: Bundle(url: nibUrl!)!)
tableView.register(timelineTableViewCellNib, forCellReuseIdentifier: "TimelineTableViewCell")

But getting error

Fatal error: Unexpectedly found nil while unwrapping an Optional value

Steps to reproduce

  1. I have taken a new fresh project
  2. Added a tableView in it.
  3. And followed your usage.
  4. Wrote the TableDataSource functions same as you written in the demo.

Please help me. / Please connect with me to fix this.

reverse timeline

would be great to support reverse timeline from bottom to top

Separator TableView

Hello, I would like to ask about separators. If I want to use separator between cells there is a problem with right margin. The separator ends in the edge of display (check photo). However left side is OK. Is there any way, how to edit properties of this separator?
snimka obrazovky 2018-11-19 o 19 15 31

Could not load NIB in bundle

Hello, I am trying to use this library, unfortunately it doesn't work. I am beginner in swift, so I suppose, it will be some silly mistake. I have create view with tableview and swift file TimelineViewController. I have copied the code from your demo project (from TimelineTableViewController). When I am trying to run it on simulator, I get error

Could not load NIB in bundle: 'NSBundle </Users/silversurfer/Library/Developer/CoreSimulator/Devices/17FBAA4A-F887-4D71-9CD6-41D3979F4A0A/data/Containers/Bundle/Application/14C5257D-7D3E-40CA-9D46-C7E16C0DACF8/Time.app/Frameworks/TimelineTableViewCell.framework> (loaded)' with name 'TimelineTableViewCell''

Could someone help me, where I made a mistake? Thank you in advance

Title and decription on both sides

HI ,
Just checking whether it is possible to support title and description on both sides of line, based on some setting .Please share your thoughts , I want the line to be on the center and title and description to be shown on both sides alternatively.

Carthage support

Hello.
Do you plan to integrate carthage support to this project?
Would be nice.

Thanks.

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.