-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updates to RKCalendar #4
Comments
Thank you for your contribution, amazing additions. I will contact you by email. |
Hi @workingDog, Thanks for working on this and sharing it with us! The disabled options functionality that you've added is something that I am particularly interested in integrating in my app! However I noticed a small problem when the RKCalendar is not part of the ContentsView which in my Stage Delegate is the root view. Unfortunately the disabled dates don't work if I try to create a new TestView with the RKCalendar, and then include the TestView in ContentsView
Any thought on how to fix or work around this issue? Thank you very much in advance! |
Hi Raffi,
I’ve cut and pasted your code as is, and all is working fine for me.
I can see the disabled dates, gray out and un-selectable.
I’ll continue to investigate.
Ringo
… On Oct 20, 2019, at 7:10, Andrei Muresianu ***@***.***> wrote:
Hi @workingDog <https://github.com/workingDog>,
Thanks for working on this and sharing it with us! The disabled options functionality that you've added is something that I am particularly interested in integrating in my app! However I noticed a small problem when the RKCalendar is not part of the ContentsView which in my Stage Delegate is the root view.
Unfortunately the disabled dates don't work if I try to create a new TestView with the RKCalendar, and then include the TestView in ContentsView
import SwiftUI
struct TestView : View {
@State var deselectedIsPresented = false
var rkManager4 = RKManager(calendar: Calendar.current, minimumDate: Date(), maximumDate: Date().addingTimeInterval(60*60*24*365), mode: 1)
var body: some View {
VStack (spacing: 25) {
Button(action: { self.deselectedIsPresented.toggle() }) {
Text("Example 4 - Disabled Dates Setting").foregroundColor(.blue)
}
.sheet(isPresented: self.$deselectedIsPresented, content: {
RKViewController(isPresented: self.$deselectedIsPresented, rkManager: self.rkManager4)})
datesView(dates: self.rkManager4.disabledDates)
}
.onAppear(perform: startUp)
.navigationViewStyle(StackNavigationViewStyle())
}
func datesView(dates: [Date]) -> some View {
ScrollView (.horizontal) {
HStack {
ForEach(dates, id: \.self) { date in
Text(self.getTextFromDate(date: date))
}
}
}.padding(.horizontal, 15)
}
func startUp() {
// example of pre-setting disabled dates
let testOffDates = [
Date().addingTimeInterval(60*60*24*4),
Date().addingTimeInterval(60*60*24*5),
Date().addingTimeInterval(60*60*24*7)]
rkManager4.disabledDates.append(contentsOf: testOffDates)
}
func getTextFromDate(date: Date!) -> String {
let formatter = DateFormatter()
formatter.locale = .current
formatter.dateFormat = "EEEE, MMMM d, yyyy"
return date == nil ? "" : formatter.string(from: date)
}
}
import SwiftUI
import Combine
struct ContentView: View {
var body: some View {
VStack {
TestView()
}
}
}
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#4?email_source=notifications&email_token=AAZ6GDF77HQA7HM33TBYOJTQPOAVPA5CNFSM4IPL67ZKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBX5U4A#issuecomment-544201328>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAZ6GDAHQANHAQFBWPPZ4F3QPOAVPANCNFSM4IPL67ZA>.
|
Thank you! I should have mentioned that I'm running it on Xcode Beta 7 |
I’m running on Xcode 11.2 beta 2.
But I believe it also works with Xcode 11 GM.
… On Oct 20, 2019, at 8:15, Andrei Muresianu ***@***.***> wrote:
Thank you! I should have mentioned that I'm running it on Xcode Beta 7 Version 11.2 beta (11B41). On what version is it working for you? I can downgrade and test that if you'd like.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#4?email_source=notifications&email_token=AAZ6GDGYXN46PYWV3LTJPELQPOIKFA5CNFSM4IPL67ZKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBX6RHI#issuecomment-544204957>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAZ6GDD62BR7OW66NLUAJEDQPOIKFANCNFSM4IPL67ZA>.
|
I’m also now on macOS 10.15 Catalina
… On Oct 20, 2019, at 8:15, Andrei Muresianu ***@***.***> wrote:
Thank you! I should have mentioned that I'm running it on Xcode Beta 7 Version 11.2 beta (11B41). On what version is it working for you? I can downgrade and test that if you'd like.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#4?email_source=notifications&email_token=AAZ6GDGYXN46PYWV3LTJPELQPOIKFA5CNFSM4IPL67ZKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBX6RHI#issuecomment-544204957>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAZ6GDD62BR7OW66NLUAJEDQPOIKFANCNFSM4IPL67ZA>.
|
Hi Raffi, Thanks for creating such a simple to use calendar. Could you help with this? |
I could not replicate your problem. Could you track down where exactly this warning comes from. Maybe the warning has the name of the class or struct. Could you share that. |
Thanks for your quick reply. I figured it out. Turns out List() doesn't load all of its content in once (like LazyVStack). So, the ForEach() in the List of RKViewController.swift only populated 19 rows (months) initially in my case rather than 25 (for two years). The smaller the device screen, the less rows the List() would load. I changed the List() to: Many thanks any way! |
I'm glad you worked it out. You maybe be interested in my fork of RKCalendar, with a number of additional features at: https://github.com/workingDog/RKCalendar I'd be interested to see if you get the same issue with it. |
RaffiKian, great project.
I've made some modifications to your code to include xCode 11 beta 6, multi-dates selection, disabled dates option, etc... If you are interested in these I'd be happy to do another pull request. If not let me know.
https://github.com/workingDog/RKCalendar
The text was updated successfully, but these errors were encountered: