Skip to content

Commit

Permalink
Merge pull request #355 from glaphi/refactor/code-cleanup
Browse files Browse the repository at this point in the history
Refactor code cleanup
  • Loading branch information
richardtop authored Mar 19, 2023
2 parents 1962aec + eafdcde commit 0a0cee8
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Sources/DayViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ open class DayViewController: UIViewController, EventDataSource, DayViewDelegate
}

open func eventsForDate(_ date: Date) -> [EventDescriptor] {
return [Event]()
[Event]()
}

// MARK: - DayViewDelegate
Expand Down
2 changes: 1 addition & 1 deletion Sources/DayViewState.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public final class DayViewState {
}

private func allClientsWithout(client: DayViewStateUpdating) -> [DayViewStateUpdating] {
return clients.filter{$0 !== client}
clients.filter{$0 !== client}
}

private func notify(clients: [DayViewStateUpdating], moveTo date: Date) {
Expand Down
10 changes: 5 additions & 5 deletions Sources/Extensions/Array+Shift.swift
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
extension Array {
mutating func shift(_ amount: Int) {
var amount = amount
guard -count...count ~= amount else { return }
if amount < 0 { amount += count }
self = Array(self[amount ..< count] + self[0 ..< amount])
mutating func shift(_ offset: Int) {
var offset = offset
guard abs(offset) < count else { return }
if offset < 0 { offset += count }
self = Array(self[offset ..< count] + self[0 ..< offset])
}
}
2 changes: 1 addition & 1 deletion Sources/Header/DaySelector/DayDateCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public final class DayDateCell: UIView, DaySelectorItemProtocol {
}

private func component(component: Calendar.Component, from date: Date) -> Int {
return calendar.component(component, from: date)
calendar.component(component, from: date)
}

private func isAWeekend(date: Date) -> Bool {
Expand Down
5 changes: 3 additions & 2 deletions Sources/Header/SwipeLabelView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,9 @@ public final class SwipeLabelView: UIView, DayViewStateUpdating {
// MARK: DayViewStateUpdating

public func move(from oldDate: Date, to newDate: Date) {
guard newDate != oldDate
else { return }
guard newDate != oldDate else {
return
}
labels.last!.text = formattedDate(date: newDate)

var direction: AnimationDirection = newDate > oldDate ? .Forward : .Backward
Expand Down
2 changes: 1 addition & 1 deletion Sources/Timeline/Event.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public final class Event: EventDescriptor {
}

public func commitEditing() {
guard let edited = editedEvent else {return}
guard let edited = editedEvent else { return }
edited.dateInterval = dateInterval
}

Expand Down
2 changes: 1 addition & 1 deletion Sources/Timeline/TimelineView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ public final class TimelineView: UIView {
}

private func component(component: Calendar.Component, from date: Date) -> Int {
return calendar.component(component, from: date)
calendar.component(component, from: date)
}

private func getDateInterval(date: Date) -> DateInterval {
Expand Down

0 comments on commit 0a0cee8

Please sign in to comment.