{"action":"opened","issue":{"url":"https://api.github.com/repos/Mozharovsky/CVCalendar/issues/364","repository_url":"https://api.github.com/repos/Mozharovsky/CVCalendar","labels_url":"https://api.github.com/repos/Mozharovsky/CVCalendar/issues/364/labels{/name}","comments_url":"https://api.github.com/repos/Mozharovsky/CVCalendar/issues/364/comments","events_url":"https://api.github.com/repos/Mozharovsky/CVCalendar/issues/364/events","html_url":"https://github.com/Mozharovsky/CVCalendar/issues/364","id":183382984,"number":364,"title":"There is no way to remove preliminary view","user":{"login":"Antondomashnev","id":2076088,"avatar_url":"https://avatars.githubusercontent.com/u/2076088?v=3","gravatar_id":"","url":"https://api.github.com/users/Antondomashnev","html_url":"https://github.com/Antondomashnev","followers_url":"https://api.github.com/users/Antondomashnev/followers","following_url":"https://api.github.com/users/Antondomashnev/following{/other_user}","gists_url":"https://api.github.com/users/Antondomashnev/gists{/gist_id}","starred_url":"https://api.github.com/users/Antondomashnev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Antondomashnev/subscriptions","organizations_url":"https://api.github.com/users/Antondomashnev/orgs","repos_url":"https://api.github.com/users/Antondomashnev/repos","events_url":"https://api.github.com/users/Antondomashnev/events{/privacy}","received_events_url":"https://api.github.com/users/Antondomashnev/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-10-17T10:44:12Z","updated_at":"2016-10-17T10:44:12Z","closed_at":null,"body":"- [x] I have verified there are no duplicate active or recent bugs, questions, or requests\r\n- [x] I have verified that I am using the latest version of CVCalendar.\r\n- [x] I have given my issue a non-generic title.\r\n\r\n## Expected Behavior\r\nThis is a hack way to implement something similar to multiple day selections. Below is simplified code.  \r\nIf I add the preliminary view using\r\n```\r\nfunc preliminaryView(shouldDisplayOnDayView dayView: DayView) -> Bool {\r\n  return dayView.date >= beginDate && dayView.date <= endDate\r\n}\r\n```\r\nAnd then if I refresh the month\r\n```\r\ncalendarView.contentController.refreshPresentedMonth()\r\n```\r\nI'll see the expected behavior - multiple day views between `beginDate` and `endDate` are selected. When I select another date - `refreshPresentedMonth` should update UI.\r\n\r\n\r\n## Current Behavior\r\nThe bug appears when I select another date, earlier than `endDate`. After refreshing the presented month I can see still preliminary view that were added by the previous step.\r\n\r\n## Possible Solution\r\nIn `CVCalendarDayView` store `preliminaryView` and update function:\r\n```\r\npublic func preliminarySetup() {\r\n        if let delegate = calendarView.delegate,\r\n            let shouldShow = delegate.preliminaryView?(shouldDisplayOnDayView: self) , shouldShow {\r\n                if let preView = delegate.preliminaryView?(viewOnDayView: self) {\r\n                    preliminaryView = preView\r\n                    insertSubview(preView, at: 0)\r\n                    preView.layer.zPosition = CGFloat(-MAXFLOAT)\r\n                }\r\n        }\r\n        else {\r\n            preliminaryView.removeFromSuperview()\r\n       }\r\n}\r\n```\r\n\r\n## Steps to Reproduce (for bugs)\r\nI'll provide a sample project soon.\r\n\r\n## Context\r\nI'm trying to mimic the functionality to select multiple dates. This issue prevents me to finish with the possible workaround.\r\n\r\n## Your Environment\r\n<!--- Include as many relevant details about the environment you experienced the bug in -->\r\n* Version used (Cocoapods spec): 1.1.0.rc.2\r\n* Device used i.e. iPhone 6S: iPad Air 2 (9.3) Simulator\r\n* Physical device (y/n): no\r\n* Link to your project (if available): private =(\r\n"}}
{"actor":{"display_login":"Antondomashnev"}}