{"id":13777496,"url":"https://github.com/EvanCooper9/swift-week-view","last_synced_at":"2025-05-11T11:33:49.304Z","repository":{"id":41344834,"uuid":"100825584","full_name":"EvanCooper9/swift-week-view","owner":"EvanCooper9","description":"An iOS calendar library for displaying calendar events in a week view.","archived":false,"fork":false,"pushed_at":"2021-04-22T13:16:13.000Z","size":20875,"stargazers_count":206,"open_issues_count":9,"forks_count":21,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-08-03T18:11:41.401Z","etag":null,"topics":["asynchronous","calendar","calendar-view","ios","swift","swiftui","week-view","weekview"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/EvanCooper9.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-08-19T22:50:04.000Z","updated_at":"2024-07-29T22:33:32.000Z","dependencies_parsed_at":"2022-08-10T01:54:45.891Z","dependency_job_id":null,"html_url":"https://github.com/EvanCooper9/swift-week-view","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EvanCooper9%2Fswift-week-view","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EvanCooper9%2Fswift-week-view/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EvanCooper9%2Fswift-week-view/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EvanCooper9%2Fswift-week-view/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EvanCooper9","download_url":"https://codeload.github.com/EvanCooper9/swift-week-view/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225043138,"owners_count":17411933,"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":["asynchronous","calendar","calendar-view","ios","swift","swiftui","week-view","weekview"],"created_at":"2024-08-03T18:00:44.356Z","updated_at":"2024-11-17T13:30:50.455Z","avatar_url":"https://github.com/EvanCooper9.png","language":"Swift","funding_links":[],"categories":["Calendar"],"sub_categories":["Content"],"readme":"# ECWeekView\n\nSee the [swiftui](https://github.com/EvanCooper9/swift-week-view/tree/swiftui) branch for updates.\n\nAn iOS calendar library for displaying calendar events in a week view.\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"Media/screen1.png\" width=\"30%\" height=\"auto\"\u003e\n    \u003cimg src=\"Media/interacting_with_events.gif\" width=\"30%\" height=\"auto\"\u003e\n    \u003cimg src=\"Media/scrolling_through_events.gif\" width=\"30%\" height=\"auto\"\u003e\n\u003c/p\u003e\n\n## Features\n- See calendar events in a week view\n- Asynchronously load calendar events\n- Interaction with specific events by clicking\n- Interaction with free time spaces by clicking\n- Custom styling\n- Infinite horizontal scrolling\n\n## Installation\n### Swift Package Manager\n```\n.package(url: \"https://github.com/EvanCooper9/swift-week-view\")\n```\n\n## Usage\n### 1. Implement the `ECWeekViewDataSource`\nImplement the `weekViewGenerateEvents` protocol function. This function should return a list of `ECWeekViewEvent`s specific to the day of `date`. Events that can be created immediately should be returned to this function. Events that require time to create should be passed to `eventCompletion`, which will overwrite previously returned events. See [here](malcommac.github.io/SwiftDate/manipulate_dates.html#dateatunit) for SwiftDate documentation on creating date objects at specific times. Currently, events rely on a [24-hour clock](https://en.wikipedia.org/wiki/24-hour_clock).\n\n```Swift\nfunc weekViewGenerateEvents(_ weekView: ECWeekView, date: DateInRegion, eventCompletion: @escaping ([ECWeekViewEvent]?) -\u003e Void) -\u003e [ECWeekViewEvent]? {\n  let start: DateInRegion = date.dateBySet(hour: 12, min: 0, secs: 0)!\n  let end: DateInRegion = date.dateBySet(hour: 13, min: 0, secs: 0)!\n  let event: ECWeekViewEvent = ECWeekViewEvent(title: \"Lunch\", start: start, end: end)\n\n  DispatchQueue.global(.background).async {\n    // do some async work \u0026 create events...\n    eventCompletion([event, ...])\n  }\n\n  return [event]\n}\n```\n#### Available arguments for `ECWeekViewEvent`\n- `title`: the title of the event\n- `subtitle`: a subtitle or description of the event\n- `start`: the start time of the event\n- `end`: the end time of the event\n\n### 2. Initialize the instance\n#### 2A. Programmatically\nCreate an instance of `ECWeekView`, specify it's data source, and add it as a subview.\n\n```Swift\nlet weekView = ECWeekView(frame: frame, visibleDays: 5)\nweekView.dataSource = self\naddSubview(weekView)\n```\n##### Available arguments for `ECWeekView`\n- `frame`: the frame of the calendar view\n- `visibleDays`: amount of days that are visible on one page. Default = 5\n- `date`: (Optional) the day `ECWeekView` will initially load. Default = today\n\n#### 2B. Storyboard\nAdd a view to the storyboard and set it's class `ECWeekView`. Assign the view's data source programmatically.\n```Swift\n@IBOutlet weak var weekView: ECWeekView!\nweekView.dataSource = self\n```\n\n## User Interaction\nTo handle interaction with `ECWeekView`, implement the `ECWeekViewDelegate` protocol and set the `delegate` property to the implementing class.\n\n```Swift\n// Fires when a calendar event is touched on\nfunc weekViewDidClickOnEvent(_ weekView: ECWeekView, event: ECWeekViewEvent, view: UIView)\n\n// Fires when a space without an event is tapped\nfunc weekViewDidClickOnFreeTime(_ weekView: ECWeekView, date: DateInRegion)\n```\n\n## Custom Styling\nTo use custom styling, implement the `ECWeekViewStyler` protocol and assign the `styler` property to the implementing class. `ECWeekView` by default is its own styler.\n\n```Swift\n// Creates the view for an event\nfunc weekViewStylerECEventView(_ weekView: ECWeekView, eventContainer: CGRect, event: ECWeekViewEvent) -\u003e UIView\n\n// Create the header view for the day in the calendar. This would normally contain information about the date\nfunc weekViewStylerHeaderView(_ weekView: ECWeekView, with date: DateInRegion, in cell: UICollectionViewCell) -\u003e UIView\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FEvanCooper9%2Fswift-week-view","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FEvanCooper9%2Fswift-week-view","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FEvanCooper9%2Fswift-week-view/lists"}