|ReleasedLast Release||Sep 2017|
Maintained by Reinert Lemmens.
|Apps WeekApps This Week||4|
|LOCLines of Code||2,696|
QVRWeekView is a work in progress framework that contains a week/day view that allows you to display, add and remove events.
To run the example project, clone the repo, and run
pod install from the Example directory first. Most useful example code can be found in
Example > QVRWeekView > CalendarViewController or StartViewController
This pod requires a minimum deployment target of iOS 9.0.
QVRWeekView is available through CocoaPods. To install it, simply add the following line to your Podfile:
Once the framework is installed, there are two ways you can incorporate the
WeekView into your project:
To add the WeekView programatically, simply import
QVRWeekView into your code by adding:
at the top of your source file containing your view controller. Then insert the WeekView into your view controller by adding:
let weekView = WeekView(frame: self.view.frame) self.view.addSubview(weekView)
into either your viewDidLoad or viewWillAppear method.
To add the
WeekView via the storyboard, simply add a View onto your View Controller and resize it or add constraints. Then go to the identity inspector of your view and select the Class to be
WeekView and the module to be
QVRWeekView (See image).
Then you should be all set!
WeekView has a delegate called
WeekViewDelegate. For now this delegate contains only three functions:
|didLongPressDayView||weekView: ||Called when a dayView column is long pressed. The passed ||Use this function to add individual user events|
|didTapEvent||weekView: ||Called when an event is tapped. ||Use this function to prompt event editing or removal|
|loadNewEvents||weekView: ||Called when events are ready to be loaded. ||Use this function to load in stored events|
|updateTimeDisplayed|| ||Updates the time displayed by the hour indicator|
|showDay||date: ||Scrolls the week view to the day passed by |
|showToday|| ||Scrolls the week view to today|
|loadEvents||eventsData: ||Loads, processes and displays the events provided by the |
EventData is the main object used to communicate events between the WeekView and your code. EventData can be overriden.
|id: ||A unique identifier for this event|
|title: ||A title that will be displayed for this event|
|startDate: ||The start date for this event|
|endDate: ||The end date for this event|
|color: ||The main color for this event|
|allDay: ||Indicates if this event is an all day event, all day events are displayed along the top bar|
|configureGradient()||Used to configure a gradient that will be used to render your event instead of just a solid color|
Below is a table of all customizable properties of the
The main WeekView view is a subclass of UIView. The view layout is retrieved from the WeekView xib file. WeekView contains a top and side bar sub view. The side bar contains an HourSideBarView which displays the hours. WeekView also contains a DayScrollView (UIScrollView subclass) which controls vertical scrolling and also delegates and contains a DayCollectionView (UICollectionView subclass) which controls the horizontal scrolling. DayCollectionView cells are DayViewCells, whose view is generated programtically (due to inefficiencies caused by auto-layout).
WeekView handles all top level operations such as pinch gestures and orientation change. Scrolling of the top and side bar is handled by a function inside of WeekView which is called by the DayScrollView when scrolling. Top bar day labels are generated, displayed and discarded simulaneously with DayCollectionView cells by the WeekView.
Reinert Lemmens, [email protected]
QVRWeekView is available under the MIT license. See the LICENSE file for more info.