Skip to content

Commit

Permalink
Revert "Basic SwiftPM support (#10)" (#11)
Browse files Browse the repository at this point in the history
This reverts commit e228c06.
  • Loading branch information
RaffiKian authored Feb 5, 2020
1 parent e228c06 commit f26c56f
Show file tree
Hide file tree
Showing 11 changed files with 93 additions and 247 deletions.
118 changes: 0 additions & 118 deletions .gitignore

This file was deleted.

31 changes: 0 additions & 31 deletions Package.swift

This file was deleted.

File renamed without changes.
33 changes: 33 additions & 0 deletions RKCalendar/Manager/RKColorSettings.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//
// RKColorSettings.swift
// RKCalendar
//
// Copyright © 2019 Raffi Kian. All rights reserved.
//

import Foundation
import Combine
import SwiftUI

class RKColorSettings : ObservableObject {

// foreground colors
@Published var textColor: Color = Color.primary
@Published var todayColor: Color = Color.white
@Published var selectedColor: Color = Color.white
@Published var disabledColor: Color = Color.gray
@Published var betweenStartAndEndColor: Color = Color.white
// background colors
@Published var textBackColor: Color = Color.clear
@Published var todayBackColor: Color = Color.gray
@Published var selectedBackColor: Color = Color.red
@Published var disabledBackColor: Color = Color.clear
@Published var betweenStartAndEndBackColor: Color = Color.blue
// headers foreground colors
@Published var weekdayHeaderColor: Color = Color.primary
@Published var monthHeaderColor: Color = Color.primary
// headers background colors
@Published var weekdayHeaderBackColor: Color = Color.clear
@Published var monthBackColor: Color = Color.clear

}
File renamed without changes.
56 changes: 56 additions & 0 deletions RKCalendar/Manager/RKManager.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
//
// RKManager.swift
// RKCalendar
//
// Created by Raffi Kian on 7/14/19.
// Copyright © 2019 Raffi Kian. All rights reserved.
//

import SwiftUI

class RKManager : ObservableObject {

@Published var calendar = Calendar.current
@Published var minimumDate: Date = Date()
@Published var maximumDate: Date = Date()
@Published var disabledDates: [Date] = [Date]()
@Published var selectedDates: [Date] = [Date]()
@Published var selectedDate: Date! = nil
@Published var startDate: Date! = nil
@Published var endDate: Date! = nil

@Published var mode: Int = 0

var colors = RKColorSettings()

init(calendar: Calendar, minimumDate: Date, maximumDate: Date, selectedDates: [Date] = [Date](), mode: Int) {
self.calendar = calendar
self.minimumDate = minimumDate
self.maximumDate = maximumDate
self.selectedDates = selectedDates
self.mode = mode
}

func selectedDatesContains(date: Date) -> Bool {
if let _ = self.selectedDates.first(where: { calendar.isDate($0, inSameDayAs: date) }) {
return true
}
return false
}

func selectedDatesFindIndex(date: Date) -> Int? {
return self.selectedDates.firstIndex(where: { calendar.isDate($0, inSameDayAs: date) })
}

func disabledDatesContains(date: Date) -> Bool {
if let _ = self.disabledDates.first(where: { calendar.isDate($0, inSameDayAs: date) }) {
return true
}
return false
}

func disabledDatesFindIndex(date: Date) -> Int? {
return self.disabledDates.firstIndex(where: { calendar.isDate($0, inSameDayAs: date) })
}

}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,19 @@

import SwiftUI

public struct RKViewController: View {
struct RKViewController: View {

var isPresented: Binding<Bool>
@Binding var isPresented: Bool

@ObservedObject var rkManager: RKManager

public init (isPresented: Binding<Bool>, rkManager: RKManager) {
self.isPresented = isPresented
self.rkManager = rkManager
}

public var body: some View {
var body: some View {
Group {
RKWeekdayHeader(rkManager: self.rkManager)
Divider()
List {
ForEach(0..<numberOfMonths()) { index in
RKMonth(isPresented: self.isPresented, rkManager: self.rkManager, monthOffset: index)
RKMonth(isPresented: self.$isPresented, rkManager: self.rkManager, monthOffset: index)
}
Divider()
}
Expand Down
File renamed without changes.
33 changes: 0 additions & 33 deletions Sources/RKCalendar/RKColorSettings.swift

This file was deleted.

56 changes: 0 additions & 56 deletions Sources/RKCalendar/RKManager.swift

This file was deleted.

0 comments on commit f26c56f

Please sign in to comment.