{"action":"created","issue":{"url":"https://api.github.com/repos/AliSoftware/Reusable/issues/63","repository_url":"https://api.github.com/repos/AliSoftware/Reusable","labels_url":"https://api.github.com/repos/AliSoftware/Reusable/issues/63/labels{/name}","comments_url":"https://api.github.com/repos/AliSoftware/Reusable/issues/63/comments","events_url":"https://api.github.com/repos/AliSoftware/Reusable/issues/63/events","html_url":"https://github.com/AliSoftware/Reusable/pull/63","id":347577600,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA2MTcwMTE3","number":63,"title":"Add AutoRegistering protocol for automatic cell registration","user":{"login":"apptekstudios","id":13492172,"node_id":"MDQ6VXNlcjEzNDkyMTcy","avatar_url":"https://avatars2.githubusercontent.com/u/13492172?v=4","gravatar_id":"","url":"https://api.github.com/users/apptekstudios","html_url":"https://github.com/apptekstudios","followers_url":"https://api.github.com/users/apptekstudios/followers","following_url":"https://api.github.com/users/apptekstudios/following{/other_user}","gists_url":"https://api.github.com/users/apptekstudios/gists{/gist_id}","starred_url":"https://api.github.com/users/apptekstudios/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apptekstudios/subscriptions","organizations_url":"https://api.github.com/users/apptekstudios/orgs","repos_url":"https://api.github.com/users/apptekstudios/repos","events_url":"https://api.github.com/users/apptekstudios/events{/privacy}","received_events_url":"https://api.github.com/users/apptekstudios/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":10,"created_at":"2018-08-04T02:17:23Z","updated_at":"2018-08-25T19:16:11Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/AliSoftware/Reusable/pulls/63","html_url":"https://github.com/AliSoftware/Reusable/pull/63","diff_url":"https://github.com/AliSoftware/Reusable/pull/63.diff","patch_url":"https://github.com/AliSoftware/Reusable/pull/63.patch"},"body":"We implemented auto-Registration of tableViewCell types. This was done such that it is an optional, non-breaking change. The features is disabled by default, although that could be changed without breaking anything.\r\n\r\nWhen calling dequeueReusableCell(...), one can now specify autoRegister: true, and it will take care of ensuring that the class/nib is registered. Note that in order to get around generic constraints this required duplicating the dequeueReusableCell function for each of Reusable and NibReusable.\r\n\r\nHopefully this is useful to someone!"},"comment":{"url":"https://api.github.com/repos/AliSoftware/Reusable/issues/comments/415990637","html_url":"https://github.com/AliSoftware/Reusable/pull/63#issuecomment-415990637","issue_url":"https://api.github.com/repos/AliSoftware/Reusable/issues/63","id":415990637,"node_id":"MDEyOklzc3VlQ29tbWVudDQxNTk5MDYzNw==","user":{"login":"AliSoftware","id":216089,"node_id":"MDQ6VXNlcjIxNjA4OQ==","avatar_url":"https://avatars2.githubusercontent.com/u/216089?v=4","gravatar_id":"","url":"https://api.github.com/users/AliSoftware","html_url":"https://github.com/AliSoftware","followers_url":"https://api.github.com/users/AliSoftware/followers","following_url":"https://api.github.com/users/AliSoftware/following{/other_user}","gists_url":"https://api.github.com/users/AliSoftware/gists{/gist_id}","starred_url":"https://api.github.com/users/AliSoftware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AliSoftware/subscriptions","organizations_url":"https://api.github.com/users/AliSoftware/orgs","repos_url":"https://api.github.com/users/AliSoftware/repos","events_url":"https://api.github.com/users/AliSoftware/events{/privacy}","received_events_url":"https://api.github.com/users/AliSoftware/received_events","type":"User","site_admin":false},"created_at":"2018-08-25T19:16:11Z","updated_at":"2018-08-25T19:16:11Z","author_association":"OWNER","body":"@apptekstudios What do you think about the alternate solution of catching the ObjC exception (instead of going the whole way of using associated objects)?\r\n\r\nSomething like:\r\n\r\n```objc\r\n// ObjCException.h\r\n#import <Foundation/Foundation.h>\r\n@interface ObjC : NSObject\r\n+ (BOOL)catch:(void(^)(void))tryBlock error:(__autoreleasing NSError **)error;\r\n@end\r\n\r\n// ObjCException.m\r\n#import \"ObjCException.h\"\r\n@implementation ObjCException\r\n+ (BOOL)catch:(void(^)(void))tryBlock error:(__autoreleasing NSError **)error {\r\n    @try {\r\n        tryBlock();\r\n        return YES;\r\n    }\r\n    @catch (NSException *exception) {\r\n        *error = [[NSError alloc] initWithDomain:exception.name code:0 userInfo:exception.userInfo];\r\n        return NO;\r\n    }\r\n}\r\n@end\r\n```\r\n\r\nThen using it like this from Swift:\r\n\r\n```swift\r\nlet cell = try? ObjCException.catch {\r\n  return collectionView.dequeue(…)\r\n}\r\n```"}}
{"actor":{"display_login":"AliSoftware"}}