{"action":"created","issue":{"url":"https://api.github.com/repos/JakeLin/IBAnimatable/issues/218","repository_url":"https://api.github.com/repos/JakeLin/IBAnimatable","labels_url":"https://api.github.com/repos/JakeLin/IBAnimatable/issues/218/labels{/name}","comments_url":"https://api.github.com/repos/JakeLin/IBAnimatable/issues/218/comments","events_url":"https://api.github.com/repos/JakeLin/IBAnimatable/issues/218/events","html_url":"https://github.com/JakeLin/IBAnimatable/issues/218","id":158712379,"number":218,"title":"API Improvement proposal","user":{"login":"lastMove","id":4633817,"avatar_url":"https://avatars.githubusercontent.com/u/4633817?v=3","gravatar_id":"","url":"https://api.github.com/users/lastMove","html_url":"https://github.com/lastMove","followers_url":"https://api.github.com/users/lastMove/followers","following_url":"https://api.github.com/users/lastMove/following{/other_user}","gists_url":"https://api.github.com/users/lastMove/gists{/gist_id}","starred_url":"https://api.github.com/users/lastMove/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lastMove/subscriptions","organizations_url":"https://api.github.com/users/lastMove/orgs","repos_url":"https://api.github.com/users/lastMove/repos","events_url":"https://api.github.com/users/lastMove/events{/privacy}","received_events_url":"https://api.github.com/users/lastMove/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/JakeLin/IBAnimatable/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/JakeLin/IBAnimatable/milestones/3","html_url":"https://github.com/JakeLin/IBAnimatable/milestones/3.0","labels_url":"https://api.github.com/repos/JakeLin/IBAnimatable/milestones/3/labels","id":1580979,"number":3,"title":"3.0","description":"Major version theme: more Animatable elements (may include Material Design)","creator":{"login":"JakeLin","id":573856,"avatar_url":"https://avatars.githubusercontent.com/u/573856?v=3","gravatar_id":"","url":"https://api.github.com/users/JakeLin","html_url":"https://github.com/JakeLin","followers_url":"https://api.github.com/users/JakeLin/followers","following_url":"https://api.github.com/users/JakeLin/following{/other_user}","gists_url":"https://api.github.com/users/JakeLin/gists{/gist_id}","starred_url":"https://api.github.com/users/JakeLin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JakeLin/subscriptions","organizations_url":"https://api.github.com/users/JakeLin/orgs","repos_url":"https://api.github.com/users/JakeLin/repos","events_url":"https://api.github.com/users/JakeLin/events{/privacy}","received_events_url":"https://api.github.com/users/JakeLin/received_events","type":"User","site_admin":false},"open_issues":18,"closed_issues":8,"state":"open","created_at":"2016-02-13T10:10:37Z","updated_at":"2016-07-02T13:45:59Z","due_on":null,"closed_at":null},"comments":25,"created_at":"2016-06-06T15:56:09Z","updated_at":"2016-07-03T00:20:48Z","closed_at":null,"body":"**enum checklist to improve**\r\n- [ ] MaskType\r\n- [ ] AnimationType\r\n- [ ] GradientStartPoint\r\n- [ ] BorderSide\r\n- [ ] BlurEffectStyle\r\n- [ ] ColorType - FlatColorsTypeScript.swift\r\n- [ ] GradientType - GradientsTypeScript.swift\r\n- [ ] InteractiveGestureType\r\n- [ ] TransitionAnimationType\r\n- [ ] SystemTransitionType\r\n- [ ] TransitionFromDirection\r\n- [ ] TransitionHollowState\r\n- [ ] TransitionPageType\r\n\r\n-------- Original Message --------\r\nHi All, I really love using this library. However i think that the API can be improved.\r\n\r\nPresently a lot of properties are String because of InterfaceBuilder. Some property would be more usable, self-documented and less error-prone if they were enums with associated type.\r\n\r\nEnums with associatedType are powerful and fit perfectly with IBAnimatable Purpose.\r\n\r\nBefore pursuing one example with maskType.using enums it will be possible to make this:\r\n\r\n```Swift\r\n\r\nanimatableView.maskType = MaskType.Parrallelogram(angle:45, direction: .Top)\r\n\r\nanimatableView.maskType = .Polygon(sides:8)\r\nanimatableView.maskType = .Circle\r\n\r\nanimatableView.maskType = “Polygon(8)“ // yes this is possible since the MaskType Enum adopts StringLiteralConvertible protocol\r\n\r\nBUT (sadly) this will NOT be possible \r\n\r\nlet string = “Polygon(8);\r\nanimatableView.maskType = string // Since there is no StringConvertible protocol in swift (yet) , only String Lterals are convertible \r\n\r\n```\r\n\r\n\r\nI tried a lot of thing to be able to do this AND to stay compatible with Interface Builder But No way :(\r\n\r\nThe most convenient way IMO is to make 2 properties. \r\n```Swift\r\n\r\nprivate var maskType : String\r\nvar eMaskType : MaskType\r\n\r\n```\r\nSince the string maskType is made for Interface Builder it can be private. \r\nThe advantage is that when accessing from code they will be just one way exposed. \r\nand since MaskType is StringLiteralConvertible, the existant code that looks like : \r\nview.maskType = “Circle”\r\n\r\nwill justNeed to be transformed to \r\n\r\n`view.eMaskType = “Circle”\r\n`\r\nAnd we could use` @avalable(iOS, renamed=“eMaskType”)` in order to simplify the migration\r\n\r\n\r\n\r\nHowever, Since WWDC is soon, we can just wait to see Interface Builder improvements :) \r\nI have already refactor maskType locally to an enum, for testing this. It works.\r\n\r\nWhat do you think about it ?"},"comment":{"url":"https://api.github.com/repos/JakeLin/IBAnimatable/issues/comments/230128476","html_url":"https://github.com/JakeLin/IBAnimatable/issues/218#issuecomment-230128476","issue_url":"https://api.github.com/repos/JakeLin/IBAnimatable/issues/218","id":230128476,"user":{"login":"JakeLin","id":573856,"avatar_url":"https://avatars.githubusercontent.com/u/573856?v=3","gravatar_id":"","url":"https://api.github.com/users/JakeLin","html_url":"https://github.com/JakeLin","followers_url":"https://api.github.com/users/JakeLin/followers","following_url":"https://api.github.com/users/JakeLin/following{/other_user}","gists_url":"https://api.github.com/users/JakeLin/gists{/gist_id}","starred_url":"https://api.github.com/users/JakeLin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JakeLin/subscriptions","organizations_url":"https://api.github.com/users/JakeLin/orgs","repos_url":"https://api.github.com/users/JakeLin/repos","events_url":"https://api.github.com/users/JakeLin/events{/privacy}","received_events_url":"https://api.github.com/users/JakeLin/received_events","type":"User","site_admin":false},"created_at":"2016-07-03T00:20:47Z","updated_at":"2016-07-03T00:20:47Z","body":"@lastMove great. Because the demo is an example for the users how to use the marks correctly, there are some edge cases not in the demo app. e.g. wrong data like Wave(0,10,45), or missing parameters like Wave(up,20). They should fall back to default parameters.\r\n\r\nWe can eailiy put the incorrect settings in IB and test them. There may be some edge cases I haven't thought, we may find out when we work on it more. Please let me know if you have any questions."}}
{"actor":{"display_login":"JakeLin"}}