Code Monkey home page Code Monkey logo

Comments (16)

ThasianX avatar ThasianX commented on May 23, 2024

If I'm being honest, the way that calendar is designed from a designer perspective doesn't make sense. The way ElegantCalendar does it is that when you click a date, you can add your own accessory view that shows below the calendar. For your case, you would probably want to use MonthlyCalendarView as it seems that you don't need a yearly calendar. This library currently doesn't support horizontal scrolling but it's not hard to support. If you want to contribute, it'd be pretty easy and I'd appreciate it. I think in MonthlyCalendarView, the view it uses is ElegantVList, which is basically vertical paging. You could add an axis to the configuration such that it would either use ElegantHList or ElegantVList depending on what's provided.

from elegantcalendar.

sethi-ishmeet avatar sethi-ishmeet commented on May 23, 2024

Thanks for the suggestion. Let me go look at the repo and I'll try to open a PR this week.

from elegantcalendar.

sethi-ishmeet avatar sethi-ishmeet commented on May 23, 2024

@ThasianX Can you help me with setting up the package project? I haven't worked on a Swift Package before. How should I open the package in Xcode? and then how should I run it in the app to test my changes?

from elegantcalendar.

ThasianX avatar ThasianX commented on May 23, 2024

Good question. Open Package.swift on Xcode 11 and you should be able start editing the source files with code completion. To test your changes, open the example project that directly references the local package. For better flow, you can edit the source files directly inside the example project but you may not get code completion. If you want to run it on your phone, you’re going to have to edit code signing else the simulator will do

from elegantcalendar.

sethi-ishmeet avatar sethi-ishmeet commented on May 23, 2024

Thanks @ThasianX for the detailed steps. I am able to make the monthly view work with Horizontal scroll. But to achieve that, I had to change the pagination between yearly view and monthly view to vertical. Please look at the gif below and let me know if this is acceptable.

ezgif com-optimize

from elegantcalendar.

sethi-ishmeet avatar sethi-ishmeet commented on May 23, 2024

Also, I'm unable to push a branch to this repository to open a Pull Request. Can you help me with the process to open pull request?

from elegantcalendar.

ThasianX avatar ThasianX commented on May 23, 2024

@sethi-ishmeet Yeah I guess that's fine. A horizontal paging yearly calendar view makes more sense tbh. To make a PR, u need to first fork this repo. Commit whatever changes u made in that fork. Push that up to your fork. Then go to your forked repo page on Github. You will see something like new branch. do u want to open a pull request. So click that and Github should guide you.

from elegantcalendar.

ThasianX avatar ThasianX commented on May 23, 2024

Also, thank you so much for taking the time to help out. You only learn by doing!

from elegantcalendar.

sethi-ishmeet avatar sethi-ishmeet commented on May 23, 2024

No worries. I have created a Pull Request.

from elegantcalendar.

maray29 avatar maray29 commented on May 23, 2024

Is it possible to preview the views in the source files? For instance Source -> Views -> Monthly has WeekView.swift with a preview setup but when either Package.swift or Example project open, the preview is not working with "active scheme does not build this file" error. I tried to google to find a solution for this but without success. It's a related question so I thought to ask here.

from elegantcalendar.

ThasianX avatar ThasianX commented on May 23, 2024

@maray29 There really is no good solution with Xcode 11. Xcode 12 does have a feature like that but unfortunately Xcode 11 doesn't. And the reason the views have previews is when I was first developing this library, it was just an xcodeproj. Made it easier for me to test every single view. I didn't know that making it a Swift Package would actually break the previews until I actually did it so lol.

from elegantcalendar.

maray29 avatar maray29 commented on May 23, 2024

@ThasianX thanks, I will try with beta4, seems it was fixed in the latest update. As a beginner it is very helpful to see the preview to understand what the code does, that's why I was trying to make it work.

Could you please point me in the right direction for creating a week view that displays the current week? I saw that in the source code there's WeekView but I cannot figure out how to recreate it in the project using the tools from ElegantCalendar library. Is it possible or it's necessary to change the source code in order to display the current week view?

from elegantcalendar.

ThasianX avatar ThasianX commented on May 23, 2024

@maray29 WeekView(calendarManager: .mock, week: Date()). Just make sure your Date is within the week range passed in.

from elegantcalendar.

maray29 avatar maray29 commented on May 23, 2024

@ThasianX thanks for your reply. I tried to use WeekView but it didn't really work. I ended up creating a WeeklyCalendarView (similar to Monthly and Yearly CalendarViews) and a separate WeeklyCalendarManager. Slowly I start to understand what the code does and learn a lot from it! Although I still cannot figure out how the background color is controlled. I can change it on MonthView but it still has a white background behind it. Is it possible to have a transparent background?

from elegantcalendar.

ThasianX avatar ThasianX commented on May 23, 2024

The background color is determined by whether the device is on light or dark mode. By default, the preview simulator is in light mode. I have this strict called DarkThemePreview where any views wrapped by it will have a black background. If u want other backgrounds, you can do like β€˜.background(Color.red.edgesignoringsafearea(.all)’

from elegantcalendar.

maray29 avatar maray29 commented on May 23, 2024

I tried wrapping ExampleCalendarView with both LightThemePreview and DarkThemePreview and setting .background(Color.red.edgesignoringsafearea(.all) in LightDarkThemePreview.swift and it only changes a small top strip of background on YearlyCalendarView and no change on MonthlyCalendarView. Am doing something wrong?
Screenshot 2020-08-11 at 23 16 04

from elegantcalendar.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.