{"id":2513,"url":"https://github.com/Glow-Inc/GLCalendarView","last_synced_at":"2025-08-03T00:31:58.351Z","repository":{"id":32025334,"uuid":"35596605","full_name":"Glow-Inc/GLCalendarView","owner":"Glow-Inc","description":"A fully customizable calendar view acting as a date range picker","archived":false,"fork":false,"pushed_at":"2022-06-09T18:19:15.000Z","size":2671,"stargazers_count":855,"open_issues_count":22,"forks_count":106,"subscribers_count":34,"default_branch":"master","last_synced_at":"2024-11-14T19:02:50.137Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Glow-Inc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-05-14T07:03:24.000Z","updated_at":"2024-05-20T21:15:11.000Z","dependencies_parsed_at":"2022-08-21T03:20:17.567Z","dependency_job_id":null,"html_url":"https://github.com/Glow-Inc/GLCalendarView","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Glow-Inc%2FGLCalendarView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Glow-Inc%2FGLCalendarView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Glow-Inc%2FGLCalendarView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Glow-Inc%2FGLCalendarView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Glow-Inc","download_url":"https://codeload.github.com/Glow-Inc/GLCalendarView/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228510719,"owners_count":17931756,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-01-05T20:16:15.627Z","updated_at":"2024-12-06T18:30:32.697Z","avatar_url":"https://github.com/Glow-Inc.png","language":"Objective-C","funding_links":[],"categories":["UI","awesome-ios ##"],"sub_categories":["Calendar","Other free courses"],"readme":"![GLCalendarView](https://cocoapod-badges.herokuapp.com/v/GLCalendarView/badge.png)\n\n## Demo\n\n![GLCalendarView](https://raw.githubusercontent.com/Glow-Inc/GLCalendarView/master/demo.gif)\n\n## Installation\n#### CocoaPods\nWith CocoaPods you can simply add `GLCalendarView` in your Podfile:\n```\npod \"GLCalendarView\", \"~\u003e 1.0.0\"\n```\n#### Source File\nYou can copy all the files under the `Sources` folder into your project.\n\n## Usage\n* Init the view by placing it in the storyboard or programmatically init it and add it to your view controller.\n* In `viewDidLoad`, set the `firstDate` and `lastDate` of the calendarView.\n* In `viewWillAppear`, set up the model data and call `[self.calendarView reload];` to refresh the calendarView.\n\nTo display some ranges in the calendar view, construct some `GLCalendarDateRange` objects, set them as the model of the calendar view\n```objective-c\nNSDate *today = [NSDate date];\nNSDate *beginDate = [GLDateUtils dateByAddingDays:-23 toDate:today];\nNSDate *endDate = [GLDateUtils dateByAddingDays:-18 toDate:today];\nGLCalendarDateRange *range = [GLCalendarDateRange rangeWithBeginDate:beginDate endDate:endDate];\nrange.backgroundColor = COLOR_BLUE;\nrange.editable = YES;\nrange.binding = yourModelObject // you can bind your model to the range\n\nself.calendarView.ranges = [@[range1] mutableCopy];\n[self.calendarView reload];\n```\n\nFor the binding field, it helps in that you can bind the actual model to the range, thus you can easily retrieve the corresponding model from the range later. For example, if you are building a trip app, you probably has a Trip class, you can bind the Trip instance to the range, and if the range gets updated in the calendar view, you can easily get the Trip instance from it and do some further updates.\n\nThe calendar view will handle all the user interactions including adding, updating, or deleting a range, you just need to implement the delegate protocol to listen for those events:\n```objective-c\n@protocol GLCalendarViewDelegate \u003cNSObject\u003e\n- (BOOL)calenderView:(GLCalendarView *)calendarView canAddRangeWithBeginDate:(NSDate *)beginDate;\n- (GLCalendarDateRange *)calenderView:(GLCalendarView *)calendarView rangeToAddWithBeginDate:(NSDate *)beginDate;\n- (void)calenderView:(GLCalendarView *)calendarView beginToEditRange:(GLCalendarDateRange *)range;\n- (void)calenderView:(GLCalendarView *)calendarView finishEditRange:(GLCalendarDateRange *)range continueEditing:(BOOL)continueEditing;\n- (BOOL)calenderView:(GLCalendarView *)calendarView canUpdateRange:(GLCalendarDateRange *)range toBeginDate:(NSDate *)beginDate endDate:(NSDate *)endDate;\n- (void)calenderView:(GLCalendarView *)calendarView didUpdateRange:(GLCalendarDateRange *)range toBeginDate:(NSDate *)beginDate endDate:(NSDate *)endDate;\n@end\n```\n\nSample implementation:\n```objective-c\n- (BOOL)calenderView:(GLCalendarView *)calendarView canAddRangeWithBeginDate:(NSDate *)beginDate\n{\n    // you should check whether user can add a range with the given begin date\n    return YES;\n}\n\n- (GLCalendarDateRange *)calenderView:(GLCalendarView *)calendarView rangeToAddWithBeginDate:(NSDate *)beginDate\n{\n    // construct a new range object and return it\n    NSDate* endDate = [GLDateUtils dateByAddingDays:2 toDate:beginDate];\n    GLCalendarDateRange *range = [GLCalendarDateRange rangeWithBeginDate:beginDate endDate:endDate];\n    range.backgroundColor = [UIColor redColor];\n    range.editable = YES;\n    range.binding = yourModel // bind your model to the range instance\n    return range;\n}\n\n- (void)calenderView:(GLCalendarView *)calendarView beginToEditRange:(GLCalendarDateRange *)range\n{\n    // save the range to a instance variable so that you can make some operation on it\n    self.rangeUnderEdit = range;\n}\n\n- (void)calenderView:(GLCalendarView *)calendarView finishEditRange:(GLCalendarDateRange *)range continueEditing:(BOOL)continueEditing\n{\n    // retrieve the model from the range, do some updates to your model\n    id yourModel = range.binding;\n    self.rangeUnderEdit = nil;\n}\n\n- (BOOL)calenderView:(GLCalendarView *)calendarView canUpdateRange:(GLCalendarDateRange *)range toBeginDate:(NSDate *)beginDate endDate:(NSDate *)endDate\n{\n    // you should check whether the beginDate or the endDate is valid\n    return YES;\n}\n\n- (void)calenderView:(GLCalendarView *)calendarView didUpdateRange:(GLCalendarDateRange *)range toBeginDate:(NSDate *)beginDate endDate:(NSDate *)endDate\n{\n    // update your model if necessary\n    id yourModel = range.binding;\n}\n\n```\n\n## Appearance\n`GLCalendarView` 's appearance is fully customizable, you can adjust its look through the appearance api(generally your should config it in the AppDelegate), check the header file to see all customizable fields:\n```objective-c\n[GLCalendarView appearance].rowHeight = 54;\n[GLCalendarView appearance].padding = 6;\n[GLCalendarView appearance].weekDayTitleAttributes = @{NSFontAttributeName:[UIFont systemFontOfSize:8], NSForegroundColorAttributeName:[UIColor grayColor]};\n[GLCalendarView appearance].monthCoverAttributes = @{NSFontAttributeName:[UIFont systemFontOfSize:30]};\n\n[GLCalendarDayCell appearance].dayLabelAttributes = @{NSFontAttributeName:[UIFont systemFontOfSize:20], NSForegroundColorAttributeName:UIColorFromRGB(0x555555)};\n[GLCalendarDayCell appearance].monthLabelAttributes = @{NSFontAttributeName:[UIFont systemFontOfSize:8]};\n    \n[GLCalendarDayCell appearance].editCoverBorderWidth = 2;\n[GLCalendarDayCell appearance].editCoverBorderColor = UIColorFromRGB(0x366aac);\n[GLCalendarDayCell appearance].editCoverPointSize = 14;\n\n[GLCalendarDayCell appearance].todayBackgroundColor = UIColorFromRGB(0x366aac);\n[GLCalendarDayCell appearance].todayLabelAttributes = @{NSFontAttributeName:[UIFont systemFontOfSize:20]};\n\n[GLCalendarDayCell appearance].rangeDisplayMode = RANGE_DISPLAY_MODE_CONTINUOUS;\n```\n\nYou can clone the project and investigate the demo for more detailed usage~","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FGlow-Inc%2FGLCalendarView","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FGlow-Inc%2FGLCalendarView","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FGlow-Inc%2FGLCalendarView/lists"}