{"action":"created","comment":{"url":"https://api.github.com/repos/hyperoslo/CalendarKit/pulls/comments/45055848","id":45055848,"diff_hunk":"@@ -54,6 +63,40 @@ class DayHeaderView: UIView {\n       pagingScrollView.contentOffset = CGPoint(x: UIScreen.mainScreen().bounds.width, y: 0)\n       daySelector.delegate = self\n     }\n+    let centerDaySelector = pagingScrollView.reusableViews[1]\n+    centerDaySelector.selectedDate = selectedDate\n+  }\n+\n+  func beginningOfWeek(date: NSDate) -> NSDate {\n+    let components = calendar.components([.Year, .Month, .Day, .TimeZone, .Weekday], fromDate: date)\n+    let offset = components.weekday - calendar.firstWeekday\n+    components.day = components.day - offset\n+\n+    return calendar.dateFromComponents(components)!\n+  }\n+\n+  func selectDate(selectedDate: NSDate) {\n+    let centerDaySelector = pagingScrollView.reusableViews[1]\n+    let startDate = centerDaySelector.startDate.dateOnly()\n+\n+    let daysFrom = selectedDate.daysFrom(startDate, calendar: calendar)\n+    print(\"Days From: \\(daysFrom)\")\n+\n+    if daysFrom < 0 {\n+      print(\"isEarlierThan\")","path":"Source/Header/DayHeaderView.swift","position":99,"original_position":99,"commit_id":"4dd50b24c22bc032ae6e7332650e3b3666053ff6","original_commit_id":"4dd50b24c22bc032ae6e7332650e3b3666053ff6","user":{"login":"richardoti","id":8013017,"avatar_url":"https://avatars.githubusercontent.com/u/8013017?v=3","gravatar_id":"","url":"https://api.github.com/users/richardoti","html_url":"https://github.com/richardoti","followers_url":"https://api.github.com/users/richardoti/followers","following_url":"https://api.github.com/users/richardoti/following{/other_user}","gists_url":"https://api.github.com/users/richardoti/gists{/gist_id}","starred_url":"https://api.github.com/users/richardoti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/richardoti/subscriptions","organizations_url":"https://api.github.com/users/richardoti/orgs","repos_url":"https://api.github.com/users/richardoti/repos","events_url":"https://api.github.com/users/richardoti/events{/privacy}","received_events_url":"https://api.github.com/users/richardoti/received_events","type":"User","site_admin":false},"body":"That's definitely for debugging purposes, so it should be there for now. ","created_at":"2015-11-17T12:52:54Z","updated_at":"2015-11-17T12:52:54Z","html_url":"https://github.com/hyperoslo/CalendarKit/pull/5#discussion_r45055848","pull_request_url":"https://api.github.com/repos/hyperoslo/CalendarKit/pulls/5","_links":{"self":{"href":"https://api.github.com/repos/hyperoslo/CalendarKit/pulls/comments/45055848"},"html":{"href":"https://github.com/hyperoslo/CalendarKit/pull/5#discussion_r45055848"},"pull_request":{"href":"https://api.github.com/repos/hyperoslo/CalendarKit/pulls/5"}}},"pull_request":{"url":"https://api.github.com/repos/hyperoslo/CalendarKit/pulls/5","id":50904081,"html_url":"https://github.com/hyperoslo/CalendarKit/pull/5","diff_url":"https://github.com/hyperoslo/CalendarKit/pull/5.diff","patch_url":"https://github.com/hyperoslo/CalendarKit/pull/5.patch","issue_url":"https://api.github.com/repos/hyperoslo/CalendarKit/issues/5","number":5,"state":"open","locked":false,"title":"Full UI implementation","user":{"login":"richardoti","id":8013017,"avatar_url":"https://avatars.githubusercontent.com/u/8013017?v=3","gravatar_id":"","url":"https://api.github.com/users/richardoti","html_url":"https://github.com/richardoti","followers_url":"https://api.github.com/users/richardoti/followers","following_url":"https://api.github.com/users/richardoti/following{/other_user}","gists_url":"https://api.github.com/users/richardoti/gists{/gist_id}","starred_url":"https://api.github.com/users/richardoti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/richardoti/subscriptions","organizations_url":"https://api.github.com/users/richardoti/orgs","repos_url":"https://api.github.com/users/richardoti/repos","events_url":"https://api.github.com/users/richardoti/events{/privacy}","received_events_url":"https://api.github.com/users/richardoti/received_events","type":"User","site_admin":false},"body":"![simulator screen shot 17 nov 2015 07 19 44](https://cloud.githubusercontent.com/assets/8013017/11202839/b24caf44-8cfd-11e5-84b0-a0a9f2a3b62d.png)\r\n\r\nKey UI components are ready.\r\nPagingScrollView now typesafe.\r\nIt works with ObjC project and iOS 7+ (Minimum version that supports Swift).\r\nMain interfaces are still to be refined after performance tests. Also, there may be some small bugs.\r\nI'm going to test it in the app and improve it during beta test as I may get new feature requests.\r\nTemporary labels and `print`-statements are for testing purposes and I think it's too early to remove them.\r\n\r\n@hyperoslo/ios ","created_at":"2015-11-17T04:48:19Z","updated_at":"2015-11-17T12:52:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c665fb63027b9b13cb4c20435e92581a46d69b17","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/hyperoslo/CalendarKit/pulls/5/commits","review_comments_url":"https://api.github.com/repos/hyperoslo/CalendarKit/pulls/5/comments","review_comment_url":"https://api.github.com/repos/hyperoslo/CalendarKit/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hyperoslo/CalendarKit/issues/5/comments","statuses_url":"https://api.github.com/repos/hyperoslo/CalendarKit/statuses/4dd50b24c22bc032ae6e7332650e3b3666053ff6","head":{"label":"hyperoslo:breaking-down-paging-scrollview","ref":"breaking-down-paging-scrollview","sha":"4dd50b24c22bc032ae6e7332650e3b3666053ff6","user":{"login":"hyperoslo","id":1340892,"avatar_url":"https://avatars.githubusercontent.com/u/1340892?v=3","gravatar_id":"","url":"https://api.github.com/users/hyperoslo","html_url":"https://github.com/hyperoslo","followers_url":"https://api.github.com/users/hyperoslo/followers","following_url":"https://api.github.com/users/hyperoslo/following{/other_user}","gists_url":"https://api.github.com/users/hyperoslo/gists{/gist_id}","starred_url":"https://api.github.com/users/hyperoslo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hyperoslo/subscriptions","organizations_url":"https://api.github.com/users/hyperoslo/orgs","repos_url":"https://api.github.com/users/hyperoslo/repos","events_url":"https://api.github.com/users/hyperoslo/events{/privacy}","received_events_url":"https://api.github.com/users/hyperoslo/received_events","type":"Organization","site_admin":false},"repo":{"id":44537782,"name":"CalendarKit","full_name":"hyperoslo/CalendarKit","owner":{"login":"hyperoslo","id":1340892,"avatar_url":"https://avatars.githubusercontent.com/u/1340892?v=3","gravatar_id":"","url":"https://api.github.com/users/hyperoslo","html_url":"https://github.com/hyperoslo","followers_url":"https://api.github.com/users/hyperoslo/followers","following_url":"https://api.github.com/users/hyperoslo/following{/other_user}","gists_url":"https://api.github.com/users/hyperoslo/gists{/gist_id}","starred_url":"https://api.github.com/users/hyperoslo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hyperoslo/subscriptions","organizations_url":"https://api.github.com/users/hyperoslo/orgs","repos_url":"https://api.github.com/users/hyperoslo/repos","events_url":"https://api.github.com/users/hyperoslo/events{/privacy}","received_events_url":"https://api.github.com/users/hyperoslo/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hyperoslo/CalendarKit","description":"Clone of iOS Calendar app","fork":false,"url":"https://api.github.com/repos/hyperoslo/CalendarKit","forks_url":"https://api.github.com/repos/hyperoslo/CalendarKit/forks","keys_url":"https://api.github.com/repos/hyperoslo/CalendarKit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hyperoslo/CalendarKit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hyperoslo/CalendarKit/teams","hooks_url":"https://api.github.com/repos/hyperoslo/CalendarKit/hooks","issue_events_url":"https://api.github.com/repos/hyperoslo/CalendarKit/issues/events{/number}","events_url":"https://api.github.com/repos/hyperoslo/CalendarKit/events","assignees_url":"https://api.github.com/repos/hyperoslo/CalendarKit/assignees{/user}","branches_url":"https://api.github.com/repos/hyperoslo/CalendarKit/branches{/branch}","tags_url":"https://api.github.com/repos/hyperoslo/CalendarKit/tags","blobs_url":"https://api.github.com/repos/hyperoslo/CalendarKit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hyperoslo/CalendarKit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hyperoslo/CalendarKit/git/refs{/sha}","trees_url":"https://api.github.com/repos/hyperoslo/CalendarKit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hyperoslo/CalendarKit/statuses/{sha}","languages_url":"https://api.github.com/repos/hyperoslo/CalendarKit/languages","stargazers_url":"https://api.github.com/repos/hyperoslo/CalendarKit/stargazers","contributors_url":"https://api.github.com/repos/hyperoslo/CalendarKit/contributors","subscribers_url":"https://api.github.com/repos/hyperoslo/CalendarKit/subscribers","subscription_url":"https://api.github.com/repos/hyperoslo/CalendarKit/subscription","commits_url":"https://api.github.com/repos/hyperoslo/CalendarKit/commits{/sha}","git_commits_url":"https://api.github.com/repos/hyperoslo/CalendarKit/git/commits{/sha}","comments_url":"https://api.github.com/repos/hyperoslo/CalendarKit/comments{/number}","issue_comment_url":"https://api.github.com/repos/hyperoslo/CalendarKit/issues/comments{/number}","contents_url":"https://api.github.com/repos/hyperoslo/CalendarKit/contents/{+path}","compare_url":"https://api.github.com/repos/hyperoslo/CalendarKit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hyperoslo/CalendarKit/merges","archive_url":"https://api.github.com/repos/hyperoslo/CalendarKit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hyperoslo/CalendarKit/downloads","issues_url":"https://api.github.com/repos/hyperoslo/CalendarKit/issues{/number}","pulls_url":"https://api.github.com/repos/hyperoslo/CalendarKit/pulls{/number}","milestones_url":"https://api.github.com/repos/hyperoslo/CalendarKit/milestones{/number}","notifications_url":"https://api.github.com/repos/hyperoslo/CalendarKit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hyperoslo/CalendarKit/labels{/name}","releases_url":"https://api.github.com/repos/hyperoslo/CalendarKit/releases{/id}","created_at":"2015-10-19T13:45:05Z","updated_at":"2015-11-01T20:24:21Z","pushed_at":"2015-11-17T05:16:53Z","git_url":"git://github.com/hyperoslo/CalendarKit.git","ssh_url":"git@github.com:hyperoslo/CalendarKit.git","clone_url":"https://github.com/hyperoslo/CalendarKit.git","svn_url":"https://github.com/hyperoslo/CalendarKit","homepage":"","size":108,"stargazers_count":2,"watchers_count":2,"language":"Swift","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":2,"default_branch":"master"}},"base":{"label":"hyperoslo:master","ref":"master","sha":"85d670f73340415481323e849645e11e513997fe","user":{"login":"hyperoslo","id":1340892,"avatar_url":"https://avatars.githubusercontent.com/u/1340892?v=3","gravatar_id":"","url":"https://api.github.com/users/hyperoslo","html_url":"https://github.com/hyperoslo","followers_url":"https://api.github.com/users/hyperoslo/followers","following_url":"https://api.github.com/users/hyperoslo/following{/other_user}","gists_url":"https://api.github.com/users/hyperoslo/gists{/gist_id}","starred_url":"https://api.github.com/users/hyperoslo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hyperoslo/subscriptions","organizations_url":"https://api.github.com/users/hyperoslo/orgs","repos_url":"https://api.github.com/users/hyperoslo/repos","events_url":"https://api.github.com/users/hyperoslo/events{/privacy}","received_events_url":"https://api.github.com/users/hyperoslo/received_events","type":"Organization","site_admin":false},"repo":{"id":44537782,"name":"CalendarKit","full_name":"hyperoslo/CalendarKit","owner":{"login":"hyperoslo","id":1340892,"avatar_url":"https://avatars.githubusercontent.com/u/1340892?v=3","gravatar_id":"","url":"https://api.github.com/users/hyperoslo","html_url":"https://github.com/hyperoslo","followers_url":"https://api.github.com/users/hyperoslo/followers","following_url":"https://api.github.com/users/hyperoslo/following{/other_user}","gists_url":"https://api.github.com/users/hyperoslo/gists{/gist_id}","starred_url":"https://api.github.com/users/hyperoslo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hyperoslo/subscriptions","organizations_url":"https://api.github.com/users/hyperoslo/orgs","repos_url":"https://api.github.com/users/hyperoslo/repos","events_url":"https://api.github.com/users/hyperoslo/events{/privacy}","received_events_url":"https://api.github.com/users/hyperoslo/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hyperoslo/CalendarKit","description":"Clone of iOS Calendar app","fork":false,"url":"https://api.github.com/repos/hyperoslo/CalendarKit","forks_url":"https://api.github.com/repos/hyperoslo/CalendarKit/forks","keys_url":"https://api.github.com/repos/hyperoslo/CalendarKit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hyperoslo/CalendarKit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hyperoslo/CalendarKit/teams","hooks_url":"https://api.github.com/repos/hyperoslo/CalendarKit/hooks","issue_events_url":"https://api.github.com/repos/hyperoslo/CalendarKit/issues/events{/number}","events_url":"https://api.github.com/repos/hyperoslo/CalendarKit/events","assignees_url":"https://api.github.com/repos/hyperoslo/CalendarKit/assignees{/user}","branches_url":"https://api.github.com/repos/hyperoslo/CalendarKit/branches{/branch}","tags_url":"https://api.github.com/repos/hyperoslo/CalendarKit/tags","blobs_url":"https://api.github.com/repos/hyperoslo/CalendarKit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hyperoslo/CalendarKit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hyperoslo/CalendarKit/git/refs{/sha}","trees_url":"https://api.github.com/repos/hyperoslo/CalendarKit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hyperoslo/CalendarKit/statuses/{sha}","languages_url":"https://api.github.com/repos/hyperoslo/CalendarKit/languages","stargazers_url":"https://api.github.com/repos/hyperoslo/CalendarKit/stargazers","contributors_url":"https://api.github.com/repos/hyperoslo/CalendarKit/contributors","subscribers_url":"https://api.github.com/repos/hyperoslo/CalendarKit/subscribers","subscription_url":"https://api.github.com/repos/hyperoslo/CalendarKit/subscription","commits_url":"https://api.github.com/repos/hyperoslo/CalendarKit/commits{/sha}","git_commits_url":"https://api.github.com/repos/hyperoslo/CalendarKit/git/commits{/sha}","comments_url":"https://api.github.com/repos/hyperoslo/CalendarKit/comments{/number}","issue_comment_url":"https://api.github.com/repos/hyperoslo/CalendarKit/issues/comments{/number}","contents_url":"https://api.github.com/repos/hyperoslo/CalendarKit/contents/{+path}","compare_url":"https://api.github.com/repos/hyperoslo/CalendarKit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hyperoslo/CalendarKit/merges","archive_url":"https://api.github.com/repos/hyperoslo/CalendarKit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hyperoslo/CalendarKit/downloads","issues_url":"https://api.github.com/repos/hyperoslo/CalendarKit/issues{/number}","pulls_url":"https://api.github.com/repos/hyperoslo/CalendarKit/pulls{/number}","milestones_url":"https://api.github.com/repos/hyperoslo/CalendarKit/milestones{/number}","notifications_url":"https://api.github.com/repos/hyperoslo/CalendarKit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hyperoslo/CalendarKit/labels{/name}","releases_url":"https://api.github.com/repos/hyperoslo/CalendarKit/releases{/id}","created_at":"2015-10-19T13:45:05Z","updated_at":"2015-11-01T20:24:21Z","pushed_at":"2015-11-17T05:16:53Z","git_url":"git://github.com/hyperoslo/CalendarKit.git","ssh_url":"git@github.com:hyperoslo/CalendarKit.git","clone_url":"https://github.com/hyperoslo/CalendarKit.git","svn_url":"https://github.com/hyperoslo/CalendarKit","homepage":"","size":108,"stargazers_count":2,"watchers_count":2,"language":"Swift","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hyperoslo/CalendarKit/pulls/5"},"html":{"href":"https://github.com/hyperoslo/CalendarKit/pull/5"},"issue":{"href":"https://api.github.com/repos/hyperoslo/CalendarKit/issues/5"},"comments":{"href":"https://api.github.com/repos/hyperoslo/CalendarKit/issues/5/comments"},"review_comments":{"href":"https://api.github.com/repos/hyperoslo/CalendarKit/pulls/5/comments"},"review_comment":{"href":"https://api.github.com/repos/hyperoslo/CalendarKit/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hyperoslo/CalendarKit/pulls/5/commits"},"statuses":{"href":"https://api.github.com/repos/hyperoslo/CalendarKit/statuses/4dd50b24c22bc032ae6e7332650e3b3666053ff6"}}}}