{"action":"created","comment":{"url":"https://api.github.com/repos/ReSwift/ReSwift/pulls/comments/70745179","id":70745179,"diff_hunk":"@@ -91,61 +83,61 @@ public class Store<State: StateType>: StoreType {\n         return true\n     }\n \n+    #if swift(>=3)\n+    public func subscribe<S: StoreSubscriber\n+        where S.StoreSubscriberStateType == State>(_ subscriber: S) {\n+            subscribe(subscriber, selector: nil)\n+    }\n+    #else\n     public func subscribe<S: StoreSubscriber\n         where S.StoreSubscriberStateType == State>(subscriber: S) {\n-            #if swift(>=3)\n-                subscribe(subscriber: subscriber, selector: nil)\n-            #else\n-                subscribe(subscriber, selector: nil)\n-            #endif\n+            subscribe(subscriber, selector: nil)\n     }\n+    #endif\n \n+    #if swift(>=3)\n+    public func subscribe<SelectedState, S: StoreSubscriber\n+        where S.StoreSubscriberStateType == SelectedState>\n+        (_ subscriber: S, selector: ((State) -> SelectedState)?) {\n+            if !_isNewSubscriber(subscriber: subscriber) { return }\n+\n+            subscriptions.append(Subscription(subscriber: subscriber, selector: selector))\n+\n+            if let state = self.state {\n+                subscriber._newState(state: selector?(state) ?? state)\n+            }\n+    }\n+    #else\n     public func subscribe<SelectedState, S: StoreSubscriber\n         where S.StoreSubscriberStateType == SelectedState>\n         (subscriber: S, selector: ((State) -> SelectedState)?) {\n-            #if swift(>=3)\n-                if !_isNewSubscriber(subscriber: subscriber) { return }\n-            #else\n-                if !_isNewSubscriber(subscriber) { return }\n-            #endif\n+            if !_isNewSubscriber(subscriber) { return }\n \n             subscriptions.append(Subscription(subscriber: subscriber, selector: selector))\n \n             if let state = self.state {\n-                #if swift(>=3)\n-                    subscriber._newState(state: selector?(state) ?? state)\n-                #else\n-                    subscriber._newState(selector?(state) ?? state)\n-                #endif\n+                subscriber._newState(selector?(state) ?? state)\n             }\n     }\n+    #endif\n \n+    #if swift(>=3)\n+    public func unsubscribe(_ subscriber: AnyStoreSubscriber) {\n+        if let index = subscriptions.index(where: { return $0.subscriber === subscriber }) {\n+            subscriptions.remove(at: index)\n+        }\n+    }\n+    #else\n     public func unsubscribe(subscriber: AnyStoreSubscriber) {\n-        #if swift(>=3)\n-            if let index = subscriptions.index(where: { return $0.subscriber === subscriber }) {\n-                subscriptions.remove(at: index)\n-            }\n-        #else\n-            if let index = subscriptions.indexOf({ return $0.subscriber === subscriber }) {\n-                subscriptions.removeAtIndex(index)\n-            }\n-        #endif\n+        if let index = subscriptions.indexOf({ return $0.subscriber === subscriber }) {\n+            subscriptions.removeAtIndex(index)\n+        }\n     }\n+    #endif\n \n     public func _defaultDispatch(action: Action) -> Any {\n-        if isDispatching {\n-            // Use Obj-C exception since throwing of exceptions can be verified through tests\n-            #if swift(>=3)\n-                NSException.raise(\n-                    \"ReSwift:IllegalDispatchFromReducer\" as NSExceptionName,\n-                    format: \"Reducers may not dispatch actions.\",\n-                    arguments: getVaList([\"nil\"]))\n-            #else\n-                NSException.raise(\n-                    \"ReSwift:IllegalDispatchFromReducer\",\n-                    format: \"Reducers may not dispatch actions.\",\n-                    arguments: getVaList([\"nil\"]))\n-            #endif\n+        guard !isDispatching else {\n+            fatalError(\"ReSwift:IllegalDispatchFromReducer - Reducers may not dispatch actions.\")\n         }","path":"ReSwift/CoreTypes/Store.swift","position":152,"original_position":152,"commit_id":"b86aff3c933dd022e245ec5bf009161232e261a2","original_commit_id":"b86aff3c933dd022e245ec5bf009161232e261a2","user":{"login":"agentk","id":117041,"avatar_url":"https://avatars.githubusercontent.com/u/117041?v=3","gravatar_id":"","url":"https://api.github.com/users/agentk","html_url":"https://github.com/agentk","followers_url":"https://api.github.com/users/agentk/followers","following_url":"https://api.github.com/users/agentk/following{/other_user}","gists_url":"https://api.github.com/users/agentk/gists{/gist_id}","starred_url":"https://api.github.com/users/agentk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agentk/subscriptions","organizations_url":"https://api.github.com/users/agentk/orgs","repos_url":"https://api.github.com/users/agentk/repos","events_url":"https://api.github.com/users/agentk/events{/privacy}","received_events_url":"https://api.github.com/users/agentk/received_events","type":"User","site_admin":false},"body":"I would prefer not to have the additional complexity and overhead to maintain too. I forgot to comeback and check if it could be made private to prevent it leaking 😬.\r\n\r\nI'll remove the change. I originally made the change because I was having a lot of trouble getting XCTest to catch the NSException in Swift 3. I think I might have worked it out now though.","created_at":"2016-07-14T03:52:09Z","updated_at":"2016-07-14T03:52:10Z","html_url":"https://github.com/ReSwift/ReSwift/pull/127#discussion_r70745179","pull_request_url":"https://api.github.com/repos/ReSwift/ReSwift/pulls/127","_links":{"self":{"href":"https://api.github.com/repos/ReSwift/ReSwift/pulls/comments/70745179"},"html":{"href":"https://github.com/ReSwift/ReSwift/pull/127#discussion_r70745179"},"pull_request":{"href":"https://api.github.com/repos/ReSwift/ReSwift/pulls/127"}}},"pull_request":{"url":"https://api.github.com/repos/ReSwift/ReSwift/pulls/127","id":76051124,"html_url":"https://github.com/ReSwift/ReSwift/pull/127","diff_url":"https://github.com/ReSwift/ReSwift/pull/127.diff","patch_url":"https://github.com/ReSwift/ReSwift/pull/127.patch","issue_url":"https://api.github.com/repos/ReSwift/ReSwift/issues/127","number":127,"state":"open","locked":false,"title":"[Tests] Migrate Quick/Nimble testing to XCTest","user":{"login":"agentk","id":117041,"avatar_url":"https://avatars.githubusercontent.com/u/117041?v=3","gravatar_id":"","url":"https://api.github.com/users/agentk","html_url":"https://github.com/agentk","followers_url":"https://api.github.com/users/agentk/followers","following_url":"https://api.github.com/users/agentk/following{/other_user}","gists_url":"https://api.github.com/users/agentk/gists{/gist_id}","starred_url":"https://api.github.com/users/agentk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agentk/subscriptions","organizations_url":"https://api.github.com/users/agentk/orgs","repos_url":"https://api.github.com/users/agentk/repos","events_url":"https://api.github.com/users/agentk/events{/privacy}","received_events_url":"https://api.github.com/users/agentk/received_events","type":"User","site_admin":false},"body":"Also along with #126 I think it would be valuable to remove Quick/Nimble in favour of plain old XCTest.\r\n\r\nCouple of reasons.\r\n- Quick fails to build for tvOS in Travis CI. This stops binary snapshots from uploading for Carthage releases: https://travis-ci.org/ReSwift/ReSwift/builds/141363703. (Debugging with binary frameworks has improved in Xcode 7.3)\r\n- SPEED: XCTest 1:44mins to build and test for macOS and iOS vs 9:29 with Quick/Nimble for just iOS tests.\r\n- Development: The whole project can be worked and tested on without any dependencies. I know it's not hard to run `carthage build --platform osx,ios`, but with XCTest, there is no step 2.\r\n- Quick and Nimble have diverged platform support into separate Swift 2.2 and 3 branches. We would no longer be able to support Swift 2...3 in one branch if we still relied on Quick/Nimble.\r\n\r\n##### Issues:\r\n###### Readability:\r\n\r\nInstead of:\r\n```\r\ndescribe(\"#deinit\") {\r\n    it(\"Deinitializes when no reference is held\") {\r\n```\r\nIt becomes:\r\n```\r\nfunc testDeinit() {\r\n    // Deinitializes when no reference is held\r\n```\r\n\r\n##### Status:\r\n\r\nI am really not sure of the best practice when naming and setting up tests with XCTest. As such, this commit is very rough and can do with a lot of scrutiny and renaming/rewording.\r\n\r\nBut that being said, it works, compiles, tests and passes with 100% code coverage in Swift 2.2 and 3.","created_at":"2016-07-02T00:42:07Z","updated_at":"2016-07-14T03:52:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"96793228f700b838de2e72b39c4ade19788d508e","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/ReSwift/ReSwift/pulls/127/commits","review_comments_url":"https://api.github.com/repos/ReSwift/ReSwift/pulls/127/comments","review_comment_url":"https://api.github.com/repos/ReSwift/ReSwift/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ReSwift/ReSwift/issues/127/comments","statuses_url":"https://api.github.com/repos/ReSwift/ReSwift/statuses/b86aff3c933dd022e245ec5bf009161232e261a2","head":{"label":"ReSwift:agentk/xctest","ref":"agentk/xctest","sha":"b86aff3c933dd022e245ec5bf009161232e261a2","user":{"login":"ReSwift","id":16023071,"avatar_url":"https://avatars.githubusercontent.com/u/16023071?v=3","gravatar_id":"","url":"https://api.github.com/users/ReSwift","html_url":"https://github.com/ReSwift","followers_url":"https://api.github.com/users/ReSwift/followers","following_url":"https://api.github.com/users/ReSwift/following{/other_user}","gists_url":"https://api.github.com/users/ReSwift/gists{/gist_id}","starred_url":"https://api.github.com/users/ReSwift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ReSwift/subscriptions","organizations_url":"https://api.github.com/users/ReSwift/orgs","repos_url":"https://api.github.com/users/ReSwift/repos","events_url":"https://api.github.com/users/ReSwift/events{/privacy}","received_events_url":"https://api.github.com/users/ReSwift/received_events","type":"Organization","site_admin":false},"repo":{"id":48027844,"name":"ReSwift","full_name":"ReSwift/ReSwift","owner":{"login":"ReSwift","id":16023071,"avatar_url":"https://avatars.githubusercontent.com/u/16023071?v=3","gravatar_id":"","url":"https://api.github.com/users/ReSwift","html_url":"https://github.com/ReSwift","followers_url":"https://api.github.com/users/ReSwift/followers","following_url":"https://api.github.com/users/ReSwift/following{/other_user}","gists_url":"https://api.github.com/users/ReSwift/gists{/gist_id}","starred_url":"https://api.github.com/users/ReSwift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ReSwift/subscriptions","organizations_url":"https://api.github.com/users/ReSwift/orgs","repos_url":"https://api.github.com/users/ReSwift/repos","events_url":"https://api.github.com/users/ReSwift/events{/privacy}","received_events_url":"https://api.github.com/users/ReSwift/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ReSwift/ReSwift","description":"Unidirectional Data Flow in Swift - Inspired by Redux","fork":false,"url":"https://api.github.com/repos/ReSwift/ReSwift","forks_url":"https://api.github.com/repos/ReSwift/ReSwift/forks","keys_url":"https://api.github.com/repos/ReSwift/ReSwift/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ReSwift/ReSwift/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ReSwift/ReSwift/teams","hooks_url":"https://api.github.com/repos/ReSwift/ReSwift/hooks","issue_events_url":"https://api.github.com/repos/ReSwift/ReSwift/issues/events{/number}","events_url":"https://api.github.com/repos/ReSwift/ReSwift/events","assignees_url":"https://api.github.com/repos/ReSwift/ReSwift/assignees{/user}","branches_url":"https://api.github.com/repos/ReSwift/ReSwift/branches{/branch}","tags_url":"https://api.github.com/repos/ReSwift/ReSwift/tags","blobs_url":"https://api.github.com/repos/ReSwift/ReSwift/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ReSwift/ReSwift/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ReSwift/ReSwift/git/refs{/sha}","trees_url":"https://api.github.com/repos/ReSwift/ReSwift/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ReSwift/ReSwift/statuses/{sha}","languages_url":"https://api.github.com/repos/ReSwift/ReSwift/languages","stargazers_url":"https://api.github.com/repos/ReSwift/ReSwift/stargazers","contributors_url":"https://api.github.com/repos/ReSwift/ReSwift/contributors","subscribers_url":"https://api.github.com/repos/ReSwift/ReSwift/subscribers","subscription_url":"https://api.github.com/repos/ReSwift/ReSwift/subscription","commits_url":"https://api.github.com/repos/ReSwift/ReSwift/commits{/sha}","git_commits_url":"https://api.github.com/repos/ReSwift/ReSwift/git/commits{/sha}","comments_url":"https://api.github.com/repos/ReSwift/ReSwift/comments{/number}","issue_comment_url":"https://api.github.com/repos/ReSwift/ReSwift/issues/comments{/number}","contents_url":"https://api.github.com/repos/ReSwift/ReSwift/contents/{+path}","compare_url":"https://api.github.com/repos/ReSwift/ReSwift/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ReSwift/ReSwift/merges","archive_url":"https://api.github.com/repos/ReSwift/ReSwift/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ReSwift/ReSwift/downloads","issues_url":"https://api.github.com/repos/ReSwift/ReSwift/issues{/number}","pulls_url":"https://api.github.com/repos/ReSwift/ReSwift/pulls{/number}","milestones_url":"https://api.github.com/repos/ReSwift/ReSwift/milestones{/number}","notifications_url":"https://api.github.com/repos/ReSwift/ReSwift/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ReSwift/ReSwift/labels{/name}","releases_url":"https://api.github.com/repos/ReSwift/ReSwift/releases{/id}","deployments_url":"https://api.github.com/repos/ReSwift/ReSwift/deployments","created_at":"2015-12-15T07:50:56Z","updated_at":"2016-07-14T02:10:03Z","pushed_at":"2016-07-09T05:26:08Z","git_url":"git://github.com/ReSwift/ReSwift.git","ssh_url":"git@github.com:ReSwift/ReSwift.git","clone_url":"https://github.com/ReSwift/ReSwift.git","svn_url":"https://github.com/ReSwift/ReSwift","homepage":"http://reswift.github.io/ReSwift/","size":4008,"stargazers_count":2172,"watchers_count":2172,"language":"Swift","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":105,"mirror_url":null,"open_issues_count":19,"forks":105,"open_issues":19,"watchers":2172,"default_branch":"master"}},"base":{"label":"ReSwift:master","ref":"master","sha":"5050789a1cdd194af53287af7f8718dcf82c112d","user":{"login":"ReSwift","id":16023071,"avatar_url":"https://avatars.githubusercontent.com/u/16023071?v=3","gravatar_id":"","url":"https://api.github.com/users/ReSwift","html_url":"https://github.com/ReSwift","followers_url":"https://api.github.com/users/ReSwift/followers","following_url":"https://api.github.com/users/ReSwift/following{/other_user}","gists_url":"https://api.github.com/users/ReSwift/gists{/gist_id}","starred_url":"https://api.github.com/users/ReSwift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ReSwift/subscriptions","organizations_url":"https://api.github.com/users/ReSwift/orgs","repos_url":"https://api.github.com/users/ReSwift/repos","events_url":"https://api.github.com/users/ReSwift/events{/privacy}","received_events_url":"https://api.github.com/users/ReSwift/received_events","type":"Organization","site_admin":false},"repo":{"id":48027844,"name":"ReSwift","full_name":"ReSwift/ReSwift","owner":{"login":"ReSwift","id":16023071,"avatar_url":"https://avatars.githubusercontent.com/u/16023071?v=3","gravatar_id":"","url":"https://api.github.com/users/ReSwift","html_url":"https://github.com/ReSwift","followers_url":"https://api.github.com/users/ReSwift/followers","following_url":"https://api.github.com/users/ReSwift/following{/other_user}","gists_url":"https://api.github.com/users/ReSwift/gists{/gist_id}","starred_url":"https://api.github.com/users/ReSwift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ReSwift/subscriptions","organizations_url":"https://api.github.com/users/ReSwift/orgs","repos_url":"https://api.github.com/users/ReSwift/repos","events_url":"https://api.github.com/users/ReSwift/events{/privacy}","received_events_url":"https://api.github.com/users/ReSwift/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ReSwift/ReSwift","description":"Unidirectional Data Flow in Swift - Inspired by Redux","fork":false,"url":"https://api.github.com/repos/ReSwift/ReSwift","forks_url":"https://api.github.com/repos/ReSwift/ReSwift/forks","keys_url":"https://api.github.com/repos/ReSwift/ReSwift/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ReSwift/ReSwift/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ReSwift/ReSwift/teams","hooks_url":"https://api.github.com/repos/ReSwift/ReSwift/hooks","issue_events_url":"https://api.github.com/repos/ReSwift/ReSwift/issues/events{/number}","events_url":"https://api.github.com/repos/ReSwift/ReSwift/events","assignees_url":"https://api.github.com/repos/ReSwift/ReSwift/assignees{/user}","branches_url":"https://api.github.com/repos/ReSwift/ReSwift/branches{/branch}","tags_url":"https://api.github.com/repos/ReSwift/ReSwift/tags","blobs_url":"https://api.github.com/repos/ReSwift/ReSwift/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ReSwift/ReSwift/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ReSwift/ReSwift/git/refs{/sha}","trees_url":"https://api.github.com/repos/ReSwift/ReSwift/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ReSwift/ReSwift/statuses/{sha}","languages_url":"https://api.github.com/repos/ReSwift/ReSwift/languages","stargazers_url":"https://api.github.com/repos/ReSwift/ReSwift/stargazers","contributors_url":"https://api.github.com/repos/ReSwift/ReSwift/contributors","subscribers_url":"https://api.github.com/repos/ReSwift/ReSwift/subscribers","subscription_url":"https://api.github.com/repos/ReSwift/ReSwift/subscription","commits_url":"https://api.github.com/repos/ReSwift/ReSwift/commits{/sha}","git_commits_url":"https://api.github.com/repos/ReSwift/ReSwift/git/commits{/sha}","comments_url":"https://api.github.com/repos/ReSwift/ReSwift/comments{/number}","issue_comment_url":"https://api.github.com/repos/ReSwift/ReSwift/issues/comments{/number}","contents_url":"https://api.github.com/repos/ReSwift/ReSwift/contents/{+path}","compare_url":"https://api.github.com/repos/ReSwift/ReSwift/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ReSwift/ReSwift/merges","archive_url":"https://api.github.com/repos/ReSwift/ReSwift/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ReSwift/ReSwift/downloads","issues_url":"https://api.github.com/repos/ReSwift/ReSwift/issues{/number}","pulls_url":"https://api.github.com/repos/ReSwift/ReSwift/pulls{/number}","milestones_url":"https://api.github.com/repos/ReSwift/ReSwift/milestones{/number}","notifications_url":"https://api.github.com/repos/ReSwift/ReSwift/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ReSwift/ReSwift/labels{/name}","releases_url":"https://api.github.com/repos/ReSwift/ReSwift/releases{/id}","deployments_url":"https://api.github.com/repos/ReSwift/ReSwift/deployments","created_at":"2015-12-15T07:50:56Z","updated_at":"2016-07-14T02:10:03Z","pushed_at":"2016-07-09T05:26:08Z","git_url":"git://github.com/ReSwift/ReSwift.git","ssh_url":"git@github.com:ReSwift/ReSwift.git","clone_url":"https://github.com/ReSwift/ReSwift.git","svn_url":"https://github.com/ReSwift/ReSwift","homepage":"http://reswift.github.io/ReSwift/","size":4008,"stargazers_count":2172,"watchers_count":2172,"language":"Swift","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":105,"mirror_url":null,"open_issues_count":19,"forks":105,"open_issues":19,"watchers":2172,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ReSwift/ReSwift/pulls/127"},"html":{"href":"https://github.com/ReSwift/ReSwift/pull/127"},"issue":{"href":"https://api.github.com/repos/ReSwift/ReSwift/issues/127"},"comments":{"href":"https://api.github.com/repos/ReSwift/ReSwift/issues/127/comments"},"review_comments":{"href":"https://api.github.com/repos/ReSwift/ReSwift/pulls/127/comments"},"review_comment":{"href":"https://api.github.com/repos/ReSwift/ReSwift/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ReSwift/ReSwift/pulls/127/commits"},"statuses":{"href":"https://api.github.com/repos/ReSwift/ReSwift/statuses/b86aff3c933dd022e245ec5bf009161232e261a2"}}}}
{"actor":{"display_login":"agentk"}}