Skip to content

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
patchthecode committed Dec 19, 2016
1 parent 1d851c8 commit 34794e0
Show file tree
Hide file tree
Showing 7 changed files with 473 additions and 141 deletions.
14 changes: 12 additions & 2 deletions Sources/CalendarEnums.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,14 @@

/// Describes a scroll destination
public enum SegmentDestination {
case next, previous, start, end
/// next the destination is the following segment
case next
/// previous the destination is the previous segment
case previous
/// start the destination is the start segment
case start
/// end the destination is the end segment
case end
}
/// Describes the types of out-date cells to be generated.
public enum OutDateCellGeneration {
Expand All @@ -30,7 +37,10 @@ public enum InDateCellGeneration {
/// Describes the calendar reading direction
/// Useful for regions that read text from right to left
public enum ReadingOrientation {
case rightToLeft, leftToRight
/// Reading orientation is from right to left
case rightToLeft
/// Reading orientation is from left to right
case leftToRight
}

/// Describes which month owns the date
Expand Down
25 changes: 14 additions & 11 deletions Sources/JTAppleCalendarView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,20 @@ open class JTAppleCalendarView: UIView {

/// Configures the behavior of the scrolling mode of the calendar
public enum ScrollingMode {
case stopAtEachCalendarFrameWidth,
stopAtEachSection,
stopAtEach(customInterval: CGFloat),
nonStopToSection(withResistance: CGFloat),
nonStopToCell(withResistance: CGFloat),
nonStopTo(customInterval: CGFloat, withResistance: CGFloat),
none
/// stopAtEachCalendarFrameWidth - non-continuous scrolling that will stop at each frame width
case stopAtEachCalendarFrameWidth
/// stopAtEachSection - non-continuous scrolling that will stop at each section
case stopAtEachSection
/// stopAtEach - non-continuous scrolling that will stop at each custom interval
case stopAtEach(customInterval: CGFloat)
/// nonStopToSection - continuous scrolling that will stop at a section
case nonStopToSection(withResistance: CGFloat)
/// nonStopToCell - continuous scrolling that will stop at a cell
case nonStopToCell(withResistance: CGFloat)
/// nonStopTo - continuous scrolling that will stop at acustom interval
case nonStopTo(customInterval: CGFloat, withResistance: CGFloat)
/// none - continuous scrolling that will eventually stop at a point
case none

func pagingIsEnabled() -> Bool {
switch self {
Expand Down Expand Up @@ -1085,10 +1092,6 @@ extension JTAppleCalendarView {
let retval = DateSegmentInfo(indates: inDates, monthDates: monthDates, outdates: outDates, indateIndexes: inDateIndexes, monthDateIndexes: monthDateIndexes, outdateIndexes: outDateIndexes)
return retval
}

open func kkk() {
calendarView.insertItems(at: [IndexPath(item: 0, section: 0)])
}

func dateOwnerInfoFromPath(_ indexPath: IndexPath) -> (date: Date, owner: DateOwner)? { // Returns nil if date is out of scope
guard let monthIndex = monthMap[indexPath.section] else {
Expand Down
1 change: 1 addition & 0 deletions Sources/JTAppleCollectionReusableView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

/// The header view class of the calendar
open class JTAppleCollectionReusableView: UICollectionReusableView, JTAppleReusableViewProtocol {
/// Header view to be customized
var view: JTAppleHeaderView?

func update() {
Expand Down
2 changes: 1 addition & 1 deletion Sources/JTAppleDayCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
/// The JTAppleDayCell class defines the attributes and
/// behavior of the cells that appear in JTAppleCalendarView objects.
open class JTAppleDayCell: UICollectionViewCell, JTAppleReusableViewProtocol {

/// Cell view that will be customized
var view: JTAppleDayCellView?

func updateCellView(_ cellInsetX: CGFloat, cellInsetY: CGFloat) {
Expand Down
5 changes: 2 additions & 3 deletions Sources/UserInteractionFunctions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -581,10 +581,9 @@ extension JTAppleCalendarView {
}

/// Scrolls the calendar view to the start of a section view header.
// If the calendar has no headers registered, then this function does
// nothing
/// If the calendar has no headers registered, then this function does nothing
/// - Paramater date: The calendar view will scroll to the header of
// a this provided date
/// a this provided date
public func scrollToHeaderForDate(_ date: Date, triggerScrollToDateDelegate: Bool = false,
withAnimation animation: Bool = false,
completionHandler: (() -> Void)? = nil) {
Expand Down
Loading

0 comments on commit 34794e0

Please sign in to comment.