Giter Site home page Giter Site logo

amantaneja / pteventview Goto Github PK

View Code? Open in Web Editor NEW
34.0 4.0 1.0 513 KB

An Event View based on Apple's Event Detail View. Written in Swift 3. Supports ARC, Autolayout and editing via StoryBoard.

License: MIT License

Ruby 100.00%
calendar cocoapods swift apple-event ibdesignable cocoapod cocoa-touch autolayout storyboard pteventview

pteventview's Introduction


An Event View based on Apple's Event Detail View. Written in Swift 3. Supports ARC, Autolayout and editing via StoryBoard.

License Platform Swift 3.x MadeWithLove

Installation

CocoaPods

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

pod 'PTEventView'

Manual

You can drag and drop the Files from here into your projects directly.

Setup

Adding PTEventView

fileprivate weak var myCalenderView: PTEventView!
// In loadView or viewDidLoad
let ptEventView = Bundle.main.loadNibNamed("PTEventView", owner: nil, options: nil)![0] as? PTEventView
ptEventView?.delegate = self
ptEventView?.setup(frame: myCalenderView.frame)
self.view.addSubview(ptEventView!)

Data Model

PTEventView supports both 12 hour and 24 hour format as data model. The input can be received from the API or Database(Core Data, Realm, SQLite) in the form of Array of Event Object.
The Event Object should have:

  • Start Time (12 hour or 24 hour)
  • End Time (12 hour or 24 hour)
  • Name of the Event
    Note: Incase of 12 hour, suffix time with AM or PM.

Example

let dataModel12hour = [["10AM","11AM","Swift Meetup '17"],["12AM","3PM","WWDC KickOff"]]
let dataModel24hour = [["10","11","Swift Meetup '17"],["12","15","WWDC KickOff"]]

Use Bool to switch between Time Formats

ptEventView?.is24HourFormat = true
for event in dataModel12hour{
            
    let eventModel = PTEventViewModel()
    
    eventModel.startTime = event[0]
    eventModel.endTime = event[1]
    eventModel.eventName = event[2]
    
    ptEventView?.EventViewdataModel.append(eventModel)
}

StoryBoard

Supports IBDesignable to alter Border Width, Corner Radius and Border Color

Customization

You can customize the view parameters for designing your own view:

borderColor - Border Color Default is Black

borderWidth - Border Width Default is 1.0

cornerRadius - Corner Radius Default is 6.0

eventColor - Event Color Default is as given in Demo Gif

eventTextColor - Event Text Color Default is white. Try to make it contrasting with eventColor

ToDo[s]

  • Add support for PM and AM via 24 hour format
  • Orientation Support. Currently supports UI for Portrait.
  • Add delegation for callbacks
  • Implement AutoLayout for CalenderView
  • Support Events on the same day
  • Add IBInspectable for Row Color of Event

Requirement

  • iOS 8.0+ (CocoaPods with Swift support will only work on iOS 8.0+. Alternatively, you will have to import library manually to your project)
  • Xcode 8.0+, Swift 3.0+

License

PTEventView is released under the MIT license. See LICENSE for details.

★Star this repo.

http://culturestreet.com/depot/620--auto--uploads-2013-12-Daily-quotes-5-December.jpg

pteventview's People

Contributors

amantaneja 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

Watchers

 avatar  avatar  avatar  avatar

Forkers

carabina

pteventview's Issues

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.