- April 27, 2024
- Mins Read
An Event View based on Apple’s Event Detail View. Written in Swift 3. Supports ARC, Autolayout and editing via StoryBoard.
PTEventView is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod ‘PTEventView’
You can drag and drop the Files from here into your projects directly.
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!)
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:
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)
}
Supports IBDesignable to alter Border Width
, Corner Radius
and Border Color
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
Horizon SDK is a state of the art real-time video recording / photo shooting iOS library. Some of the features ...