{"action":"created","comment":{"url":"https://api.github.com/repos/Ub3rmunch/TFv2/pulls/comments/222102418","pull_request_review_id":160911793,"id":222102418,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyMjEwMjQxOA==","diff_hunk":"@@ -1 +1,290 @@\n \n+// Example step implementation\n+//=====================================================================//\n+\n+struct Notices: Step {\n+    // Which properties in State is this step dependent on? And how to load them if they weren't loaded yet?\n+    func dependencies(_ state: State, completion: @escaping (State) -> Void) -> [Dependency] {\n+        let model = LoadNotices(quoteId: state.quoteId) {\n+            // After notices were loaded, call the dependencies completion closure with a copy of `state`\n+            // but with the updated notices set inside.\n+            completion(state.updated(notices: $0))\n+        }\n+\n+        let load = Service.Load.notices(model)\n+\n+        // The step is dependent on notices and here's how to load it.\n+        return [Dependency(state.notices, load)]\n+    }\n+\n+    // Should the step's `actions(...)` excute or not?\n+    func shouldExcuteActions(_ state: State) -> Bool {\n+        // Only run step if there are notices to show.\n+        return state.notices.isLoaded\n+    }\n+\n+    // The bread and butter of the step. Usually `Show` and `Track` actions.\n+    func actions(_ state: State, completion: @escaping (State) -> Void) -> [Action] {\n+        // Attempt to unwrap notices, we logically know that at this point notices can only be loaded\n+        // because dependencies must have ran and loading was attempted\n+        // and `shouldExcuteActions(...)` wouldn't let TransferFlow run the step's actions if loading failed.\n+        guard let notices = state.notices.value else {\n+            return [Router.Show.error]\n+        }\n+\n+        let model = ShowNotices(notices: notices) {\n+            // Tell TransferFlow we're done processing this step.\n+            completion(state)\n+        }\n+\n+        // Tell `TransferFlow` to show the notices screen and fire analytics events.\n+        return [Router.Show.notices(model), Analytics.Track.notices]\n+    }\n+}\n+\n+// Something you give your network/persistence layer to load a request.\n+struct LoadNotices: ActionModel {\n+    // Network client needs quoteId to fetch the notices.\n+    let quoteId: String\n+    // Callback with the loaded array of notices.\n+    let completion: ((Loadable<[String]>) -> Void)\n+}\n+\n+// Something you give your UI layer (app target?)\n+struct ShowNotices: ActionModel {\n+    // Swift generics is dumb.\n+    typealias T = Void\n+\n+    // The notices view needs the array of notices to present them.\n+    let notices: [String]\n+    // Tell the step that the user tapped \"next\" or whatever.\n+    let completion: (T) -> Void\n+}\n+\n+// Contract\n+//=====================================================================//\n+\n+protocol Step {\n+    func dependencies(_ state: State, completion: @escaping (State) -> Void) -> [Dependency]\n+\n+    func shouldExcuteActions(_ state: State) -> Bool\n+    func actions(_ state: State, completion: @escaping (State) -> Void) -> [Action]\n+}\n+\n+struct Dependency {\n+    let loadable: LoadableProtocol\n+    let loadAction: Service.Load\n+}\n+\n+protocol Action {}\n+\n+// Ensure all models are created with completion.\n+protocol ActionModel {\n+    associatedtype T\n+    var completion: ((T) -> Void) { get }","path":"TFv2.playground/Contents.swift","position":84,"original_position":84,"commit_id":"428ca99001615abc75c25f4d3c40c1de8c006694","original_commit_id":"428ca99001615abc75c25f4d3c40c1de8c006694","user":{"login":"Ub3rmunch","id":33694862,"node_id":"MDQ6VXNlcjMzNjk0ODYy","avatar_url":"https://avatars1.githubusercontent.com/u/33694862?v=4","gravatar_id":"","url":"https://api.github.com/users/Ub3rmunch","html_url":"https://github.com/Ub3rmunch","followers_url":"https://api.github.com/users/Ub3rmunch/followers","following_url":"https://api.github.com/users/Ub3rmunch/following{/other_user}","gists_url":"https://api.github.com/users/Ub3rmunch/gists{/gist_id}","starred_url":"https://api.github.com/users/Ub3rmunch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ub3rmunch/subscriptions","organizations_url":"https://api.github.com/users/Ub3rmunch/orgs","repos_url":"https://api.github.com/users/Ub3rmunch/repos","events_url":"https://api.github.com/users/Ub3rmunch/events{/privacy}","received_events_url":"https://api.github.com/users/Ub3rmunch/received_events","type":"User","site_admin":false},"body":"> Mixing Model and Bindings does not make sense to me. These are completely different things. Also, when writing tests you can’t use “.canned” because you’ll need bindings 80% of the time so you end up typing more boilerplate.","created_at":"2018-10-02T20:35:53Z","updated_at":"2018-10-02T20:39:04Z","html_url":"https://github.com/Ub3rmunch/TFv2/pull/1#discussion_r222102418","pull_request_url":"https://api.github.com/repos/Ub3rmunch/TFv2/pulls/1","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/Ub3rmunch/TFv2/pulls/comments/222102418"},"html":{"href":"https://github.com/Ub3rmunch/TFv2/pull/1#discussion_r222102418"},"pull_request":{"href":"https://api.github.com/repos/Ub3rmunch/TFv2/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/Ub3rmunch/TFv2/pulls/1","id":219836478,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE5ODM2NDc4","html_url":"https://github.com/Ub3rmunch/TFv2/pull/1","diff_url":"https://github.com/Ub3rmunch/TFv2/pull/1.diff","patch_url":"https://github.com/Ub3rmunch/TFv2/pull/1.patch","issue_url":"https://api.github.com/repos/Ub3rmunch/TFv2/issues/1","number":1,"state":"open","locked":false,"title":"Check-in first preposition","user":{"login":"Ub3rmunch","id":33694862,"node_id":"MDQ6VXNlcjMzNjk0ODYy","avatar_url":"https://avatars1.githubusercontent.com/u/33694862?v=4","gravatar_id":"","url":"https://api.github.com/users/Ub3rmunch","html_url":"https://github.com/Ub3rmunch","followers_url":"https://api.github.com/users/Ub3rmunch/followers","following_url":"https://api.github.com/users/Ub3rmunch/following{/other_user}","gists_url":"https://api.github.com/users/Ub3rmunch/gists{/gist_id}","starred_url":"https://api.github.com/users/Ub3rmunch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ub3rmunch/subscriptions","organizations_url":"https://api.github.com/users/Ub3rmunch/orgs","repos_url":"https://api.github.com/users/Ub3rmunch/repos","events_url":"https://api.github.com/users/Ub3rmunch/events{/privacy}","received_events_url":"https://api.github.com/users/Ub3rmunch/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-10-02T20:34:53Z","updated_at":"2018-10-02T20:39:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e361fe4c291b615fc7b704eba199d33d667e968e","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/Ub3rmunch/TFv2/pulls/1/commits","review_comments_url":"https://api.github.com/repos/Ub3rmunch/TFv2/pulls/1/comments","review_comment_url":"https://api.github.com/repos/Ub3rmunch/TFv2/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Ub3rmunch/TFv2/issues/1/comments","statuses_url":"https://api.github.com/repos/Ub3rmunch/TFv2/statuses/428ca99001615abc75c25f4d3c40c1de8c006694","head":{"label":"Ub3rmunch:alpha","ref":"alpha","sha":"428ca99001615abc75c25f4d3c40c1de8c006694","user":{"login":"Ub3rmunch","id":33694862,"node_id":"MDQ6VXNlcjMzNjk0ODYy","avatar_url":"https://avatars1.githubusercontent.com/u/33694862?v=4","gravatar_id":"","url":"https://api.github.com/users/Ub3rmunch","html_url":"https://github.com/Ub3rmunch","followers_url":"https://api.github.com/users/Ub3rmunch/followers","following_url":"https://api.github.com/users/Ub3rmunch/following{/other_user}","gists_url":"https://api.github.com/users/Ub3rmunch/gists{/gist_id}","starred_url":"https://api.github.com/users/Ub3rmunch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ub3rmunch/subscriptions","organizations_url":"https://api.github.com/users/Ub3rmunch/orgs","repos_url":"https://api.github.com/users/Ub3rmunch/repos","events_url":"https://api.github.com/users/Ub3rmunch/events{/privacy}","received_events_url":"https://api.github.com/users/Ub3rmunch/received_events","type":"User","site_admin":false},"repo":{"id":150723358,"node_id":"MDEwOlJlcG9zaXRvcnkxNTA3MjMzNTg=","name":"TFv2","full_name":"Ub3rmunch/TFv2","private":false,"owner":{"login":"Ub3rmunch","id":33694862,"node_id":"MDQ6VXNlcjMzNjk0ODYy","avatar_url":"https://avatars1.githubusercontent.com/u/33694862?v=4","gravatar_id":"","url":"https://api.github.com/users/Ub3rmunch","html_url":"https://github.com/Ub3rmunch","followers_url":"https://api.github.com/users/Ub3rmunch/followers","following_url":"https://api.github.com/users/Ub3rmunch/following{/other_user}","gists_url":"https://api.github.com/users/Ub3rmunch/gists{/gist_id}","starred_url":"https://api.github.com/users/Ub3rmunch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ub3rmunch/subscriptions","organizations_url":"https://api.github.com/users/Ub3rmunch/orgs","repos_url":"https://api.github.com/users/Ub3rmunch/repos","events_url":"https://api.github.com/users/Ub3rmunch/events{/privacy}","received_events_url":"https://api.github.com/users/Ub3rmunch/received_events","type":"User","site_admin":false},"html_url":"https://github.com/Ub3rmunch/TFv2","description":null,"fork":false,"url":"https://api.github.com/repos/Ub3rmunch/TFv2","forks_url":"https://api.github.com/repos/Ub3rmunch/TFv2/forks","keys_url":"https://api.github.com/repos/Ub3rmunch/TFv2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Ub3rmunch/TFv2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Ub3rmunch/TFv2/teams","hooks_url":"https://api.github.com/repos/Ub3rmunch/TFv2/hooks","issue_events_url":"https://api.github.com/repos/Ub3rmunch/TFv2/issues/events{/number}","events_url":"https://api.github.com/repos/Ub3rmunch/TFv2/events","assignees_url":"https://api.github.com/repos/Ub3rmunch/TFv2/assignees{/user}","branches_url":"https://api.github.com/repos/Ub3rmunch/TFv2/branches{/branch}","tags_url":"https://api.github.com/repos/Ub3rmunch/TFv2/tags","blobs_url":"https://api.github.com/repos/Ub3rmunch/TFv2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Ub3rmunch/TFv2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Ub3rmunch/TFv2/git/refs{/sha}","trees_url":"https://api.github.com/repos/Ub3rmunch/TFv2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Ub3rmunch/TFv2/statuses/{sha}","languages_url":"https://api.github.com/repos/Ub3rmunch/TFv2/languages","stargazers_url":"https://api.github.com/repos/Ub3rmunch/TFv2/stargazers","contributors_url":"https://api.github.com/repos/Ub3rmunch/TFv2/contributors","subscribers_url":"https://api.github.com/repos/Ub3rmunch/TFv2/subscribers","subscription_url":"https://api.github.com/repos/Ub3rmunch/TFv2/subscription","commits_url":"https://api.github.com/repos/Ub3rmunch/TFv2/commits{/sha}","git_commits_url":"https://api.github.com/repos/Ub3rmunch/TFv2/git/commits{/sha}","comments_url":"https://api.github.com/repos/Ub3rmunch/TFv2/comments{/number}","issue_comment_url":"https://api.github.com/repos/Ub3rmunch/TFv2/issues/comments{/number}","contents_url":"https://api.github.com/repos/Ub3rmunch/TFv2/contents/{+path}","compare_url":"https://api.github.com/repos/Ub3rmunch/TFv2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Ub3rmunch/TFv2/merges","archive_url":"https://api.github.com/repos/Ub3rmunch/TFv2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Ub3rmunch/TFv2/downloads","issues_url":"https://api.github.com/repos/Ub3rmunch/TFv2/issues{/number}","pulls_url":"https://api.github.com/repos/Ub3rmunch/TFv2/pulls{/number}","milestones_url":"https://api.github.com/repos/Ub3rmunch/TFv2/milestones{/number}","notifications_url":"https://api.github.com/repos/Ub3rmunch/TFv2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Ub3rmunch/TFv2/labels{/name}","releases_url":"https://api.github.com/repos/Ub3rmunch/TFv2/releases{/id}","deployments_url":"https://api.github.com/repos/Ub3rmunch/TFv2/deployments","created_at":"2018-09-28T10:19:31Z","updated_at":"2018-10-01T23:59:37Z","pushed_at":"2018-10-02T20:34:54Z","git_url":"git://github.com/Ub3rmunch/TFv2.git","ssh_url":"git@github.com:Ub3rmunch/TFv2.git","clone_url":"https://github.com/Ub3rmunch/TFv2.git","svn_url":"https://github.com/Ub3rmunch/TFv2","homepage":null,"size":56,"stargazers_count":0,"watchers_count":0,"language":"Swift","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"Ub3rmunch:release","ref":"release","sha":"2facf2e72fcdf151e4e42a286467580edcbb1e42","user":{"login":"Ub3rmunch","id":33694862,"node_id":"MDQ6VXNlcjMzNjk0ODYy","avatar_url":"https://avatars1.githubusercontent.com/u/33694862?v=4","gravatar_id":"","url":"https://api.github.com/users/Ub3rmunch","html_url":"https://github.com/Ub3rmunch","followers_url":"https://api.github.com/users/Ub3rmunch/followers","following_url":"https://api.github.com/users/Ub3rmunch/following{/other_user}","gists_url":"https://api.github.com/users/Ub3rmunch/gists{/gist_id}","starred_url":"https://api.github.com/users/Ub3rmunch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ub3rmunch/subscriptions","organizations_url":"https://api.github.com/users/Ub3rmunch/orgs","repos_url":"https://api.github.com/users/Ub3rmunch/repos","events_url":"https://api.github.com/users/Ub3rmunch/events{/privacy}","received_events_url":"https://api.github.com/users/Ub3rmunch/received_events","type":"User","site_admin":false},"repo":{"id":150723358,"node_id":"MDEwOlJlcG9zaXRvcnkxNTA3MjMzNTg=","name":"TFv2","full_name":"Ub3rmunch/TFv2","private":false,"owner":{"login":"Ub3rmunch","id":33694862,"node_id":"MDQ6VXNlcjMzNjk0ODYy","avatar_url":"https://avatars1.githubusercontent.com/u/33694862?v=4","gravatar_id":"","url":"https://api.github.com/users/Ub3rmunch","html_url":"https://github.com/Ub3rmunch","followers_url":"https://api.github.com/users/Ub3rmunch/followers","following_url":"https://api.github.com/users/Ub3rmunch/following{/other_user}","gists_url":"https://api.github.com/users/Ub3rmunch/gists{/gist_id}","starred_url":"https://api.github.com/users/Ub3rmunch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ub3rmunch/subscriptions","organizations_url":"https://api.github.com/users/Ub3rmunch/orgs","repos_url":"https://api.github.com/users/Ub3rmunch/repos","events_url":"https://api.github.com/users/Ub3rmunch/events{/privacy}","received_events_url":"https://api.github.com/users/Ub3rmunch/received_events","type":"User","site_admin":false},"html_url":"https://github.com/Ub3rmunch/TFv2","description":null,"fork":false,"url":"https://api.github.com/repos/Ub3rmunch/TFv2","forks_url":"https://api.github.com/repos/Ub3rmunch/TFv2/forks","keys_url":"https://api.github.com/repos/Ub3rmunch/TFv2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Ub3rmunch/TFv2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Ub3rmunch/TFv2/teams","hooks_url":"https://api.github.com/repos/Ub3rmunch/TFv2/hooks","issue_events_url":"https://api.github.com/repos/Ub3rmunch/TFv2/issues/events{/number}","events_url":"https://api.github.com/repos/Ub3rmunch/TFv2/events","assignees_url":"https://api.github.com/repos/Ub3rmunch/TFv2/assignees{/user}","branches_url":"https://api.github.com/repos/Ub3rmunch/TFv2/branches{/branch}","tags_url":"https://api.github.com/repos/Ub3rmunch/TFv2/tags","blobs_url":"https://api.github.com/repos/Ub3rmunch/TFv2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Ub3rmunch/TFv2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Ub3rmunch/TFv2/git/refs{/sha}","trees_url":"https://api.github.com/repos/Ub3rmunch/TFv2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Ub3rmunch/TFv2/statuses/{sha}","languages_url":"https://api.github.com/repos/Ub3rmunch/TFv2/languages","stargazers_url":"https://api.github.com/repos/Ub3rmunch/TFv2/stargazers","contributors_url":"https://api.github.com/repos/Ub3rmunch/TFv2/contributors","subscribers_url":"https://api.github.com/repos/Ub3rmunch/TFv2/subscribers","subscription_url":"https://api.github.com/repos/Ub3rmunch/TFv2/subscription","commits_url":"https://api.github.com/repos/Ub3rmunch/TFv2/commits{/sha}","git_commits_url":"https://api.github.com/repos/Ub3rmunch/TFv2/git/commits{/sha}","comments_url":"https://api.github.com/repos/Ub3rmunch/TFv2/comments{/number}","issue_comment_url":"https://api.github.com/repos/Ub3rmunch/TFv2/issues/comments{/number}","contents_url":"https://api.github.com/repos/Ub3rmunch/TFv2/contents/{+path}","compare_url":"https://api.github.com/repos/Ub3rmunch/TFv2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Ub3rmunch/TFv2/merges","archive_url":"https://api.github.com/repos/Ub3rmunch/TFv2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Ub3rmunch/TFv2/downloads","issues_url":"https://api.github.com/repos/Ub3rmunch/TFv2/issues{/number}","pulls_url":"https://api.github.com/repos/Ub3rmunch/TFv2/pulls{/number}","milestones_url":"https://api.github.com/repos/Ub3rmunch/TFv2/milestones{/number}","notifications_url":"https://api.github.com/repos/Ub3rmunch/TFv2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Ub3rmunch/TFv2/labels{/name}","releases_url":"https://api.github.com/repos/Ub3rmunch/TFv2/releases{/id}","deployments_url":"https://api.github.com/repos/Ub3rmunch/TFv2/deployments","created_at":"2018-09-28T10:19:31Z","updated_at":"2018-10-01T23:59:37Z","pushed_at":"2018-10-02T20:34:54Z","git_url":"git://github.com/Ub3rmunch/TFv2.git","ssh_url":"git@github.com:Ub3rmunch/TFv2.git","clone_url":"https://github.com/Ub3rmunch/TFv2.git","svn_url":"https://github.com/Ub3rmunch/TFv2","homepage":null,"size":56,"stargazers_count":0,"watchers_count":0,"language":"Swift","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Ub3rmunch/TFv2/pulls/1"},"html":{"href":"https://github.com/Ub3rmunch/TFv2/pull/1"},"issue":{"href":"https://api.github.com/repos/Ub3rmunch/TFv2/issues/1"},"comments":{"href":"https://api.github.com/repos/Ub3rmunch/TFv2/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/Ub3rmunch/TFv2/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/Ub3rmunch/TFv2/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Ub3rmunch/TFv2/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/Ub3rmunch/TFv2/statuses/428ca99001615abc75c25f4d3c40c1de8c006694"}},"author_association":"OWNER"}}
{"actor":{"display_login":"Ub3rmunch"}}