- Notifications
You must be signed in to change notification settings - Fork1
An Event View based on Apple's Event Detail View. Written in Swift 3. Supports ARC, Autolayout and editing via StoryBoard.
License
amantaneja/PTEventView
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
An Event View based on Apple's Event Detail View. Written in Swift 3. Supports ARC, Autolayout and editing via StoryBoard.
PTEventView is available throughCocoaPods. To install it, simply add the following line to your Podfile:
pod 'PTEventView'
You can drag and drop the Files fromhere into your projects directly.
fileprivate weakvarmyCalenderView:PTEventView!
// In loadView or viewDidLoadletptEventView=Bundle.main.loadNibNamed("PTEventView", owner:nil, options:nil)![0]as?PTEventViewptEventView?.delegate=selfptEventView?.setup(frame: myCalenderView.frame)self.view.addSubview(ptEventView!)
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 ofEvent 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
letdataModel12hour=[["10AM","11AM","Swift Meetup '17"],["12AM","3PM","WWDC KickOff"]]letdataModel24hour=[["10","11","Swift Meetup '17"],["12","15","WWDC KickOff"]]
Use Bool to switch between Time Formats
ptEventView?.is24HourFormat=true
foreventin dataModel12hour{leteventModel=PTEventViewModel() eventModel.startTime=event[0] eventModel.endTime=event[1] eventModel.eventName=event[2] ptEventView?.EventViewdataModel.append(eventModel)}
Supports IBDesignable to alterBorder Width
,Corner Radius
andBorder Color
You can customize the view parameters for designing your own view:
borderColor
- Border ColorDefault is Black
borderWidth
- Border WidthDefault is 1.0
cornerRadius
- Corner RadiusDefault is 6.0
eventColor
- Event ColorDefault is as given in Demo Gif
eventTextColor
- Event Text ColorDefault is white. Try to make it contrasting with eventColor
- 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
- 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+
PTEventView is released under the MIT license. SeeLICENSE for details.
★Star this repo.
http://culturestreet.com/depot/620--auto--uploads-2013-12-Daily-quotes-5-December.jpg
About
An Event View based on Apple's Event Detail View. Written in Swift 3. Supports ARC, Autolayout and editing via StoryBoard.