shoheiyokoyama / Koyomi

Simple customizable calendar component in Swift :calendar:
MIT License
749 stars 104 forks source link

Enable only some days to be selected + highlight those #12

Closed TadeasKriz closed 7 years ago

TadeasKriz commented 7 years ago

Is it possible to only enable some days to be selected and highlight those that can?

I need to let user know on which days there is an event going on and don't want them to select days other than those with events. Is something like this possible with Koyomi?

Thanks!

OnlyMyRailgun commented 7 years ago

The same question, will I be able to set an available list to enable some days to be selected. Thanks!

shoheiyokoyama commented 7 years ago

This feature is under development. it will be done soon.

shoheiyokoyama commented 7 years ago

@OnlyMyRailgun @TadeasKriz

Hi. Thank you for comment :laughing: I have just finished to release version 1.0.3:confetti_ball:.

Use:

func setDayColor(_ dayColor: UIColor, of date: Date, to Date: Date?)
func setDayBackgrondColor(_ backgroundColor: UIColor, of date: Date, to Date: Date?)

You can change dayColor and dayBackgroundColor in specific days.

_It's possible to select only some days!!_

If don't want user to select days , use func koyomi(_ koyomi: Koyomi, shouldSelectDates date: Date?, to: Date?, withPeriodLength lenght: Int) -> Bool in KoyomiDelegate Please return false in the case of invalid date

func koyomi(_ koyomi: Koyomi, shouldSelectDates date: Date?, to: Date?, withPeriodLength lenght: Int) -> Bool {

        // during event
        if eventStartDay <= date && eventEndDate >= date {
            return true
        } else {
            print("Your don't select \(date)")
            // user can't select day
            return false
       }
    }