{"action":"created","comment":{"url":"https://api.github.com/repos/ocelotgraphql/ios/pulls/comments/238777479","pull_request_review_id":181403482,"id":238777479,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzODc3NzQ3OQ==","diff_hunk":"@@ -0,0 +1,105 @@\n+import UIKit\n+\n+/// `UIDocument` subclass used to manage `.ocelotplayground` files.\n+public final class Playground: UIDocument {\n+\t/// Contents of the playgrounds `contents.graphql` file.\n+\tprivate (set) var contents = \"\"\n+\n+\t/// `Settings` stored inside the playgrounds `settings.json` file.\n+\tprivate (set) var settings = Settings(endpoint: nil)\n+\n+\tprivate lazy var jsonEncoder = JSONEncoder()\n+\tprivate lazy var jsonDecoder = JSONDecoder()\n+\n+\tprivate lazy var packageFileWrapper = FileWrapper(directoryWithFileWrappers: [:])\n+\n+\t/// Tells the `Playground` to store the given contents on the next save.\n+\t///\n+\t/// - Warning: This will not save the updated Playground to disk.\n+\t/// - Parameter updatedContents: The updated contents.\n+\tpublic func updateContents(_ updatedContents: String) {\n+\t\tcontents = updatedContents\n+\n+\t\tif let contentsFileWrapper = packageFileWrapper.fileWrappers?[FileName.contents] {\n+\t\t\tpackageFileWrapper.removeFileWrapper(contentsFileWrapper)\n+\t\t}\n+\t}\n+\n+\t/// Tells the `Playground` to store the given `Settings` on the next save.\n+\t///\n+\t/// - Warning: This will not save the updated Playground to disk.\n+\t/// - Parameter updatedSettings: The updated `Settings`.\n+\tpublic func updateSettings(_ updatedSettings: Settings) {\n+\t\tsettings = updatedSettings\n+\n+\t\tif let settingsFileWrapper = packageFileWrapper.fileWrappers?[FileName.settings] {\n+\t\t\tpackageFileWrapper.removeFileWrapper(settingsFileWrapper)\n+\t\t}\n+\t}\n+\n+\tpublic override func contents(forType typeName: String) throws -> Any {\n+\t\tif packageFileWrapper.fileWrappers?[FileName.contents] == nil,\n+\t\t\tlet contentsData = contents.data(using: .utf8\n+\t\t) {\n+\t\t\tlet contentsFileWrapper = FileWrapper(regularFileWithContents: contentsData)\n+\t\t\tcontentsFileWrapper.preferredFilename = FileName.contents\n+\t\t\tpackageFileWrapper.addFileWrapper(contentsFileWrapper)\n+\t\t}\n+\n+\t\tif let settingsData = try? jsonEncoder.encode(settings) {","path":"Feature/Playground/Playground/Models/Playground.swift","position":49,"original_position":49,"commit_id":"4e90ac7a523fb359641ee702c0c6d0586b328744","original_commit_id":"4e90ac7a523fb359641ee702c0c6d0586b328744","user":{"login":"slashmo","id":16192401,"node_id":"MDQ6VXNlcjE2MTkyNDAx","avatar_url":"https://avatars3.githubusercontent.com/u/16192401?v=4","gravatar_id":"","url":"https://api.github.com/users/slashmo","html_url":"https://github.com/slashmo","followers_url":"https://api.github.com/users/slashmo/followers","following_url":"https://api.github.com/users/slashmo/following{/other_user}","gists_url":"https://api.github.com/users/slashmo/gists{/gist_id}","starred_url":"https://api.github.com/users/slashmo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slashmo/subscriptions","organizations_url":"https://api.github.com/users/slashmo/orgs","repos_url":"https://api.github.com/users/slashmo/repos","events_url":"https://api.github.com/users/slashmo/events{/privacy}","received_events_url":"https://api.github.com/users/slashmo/received_events","type":"User","site_admin":false},"body":"Agreed. ✅ We should add it as property observers instead. That way we can leave the setters for both `contents` and `settings` `public` which will be more transparent to use.","created_at":"2018-12-04T18:11:49Z","updated_at":"2018-12-04T18:11:49Z","html_url":"https://github.com/ocelotgraphql/ios/pull/17#discussion_r238777479","pull_request_url":"https://api.github.com/repos/ocelotgraphql/ios/pulls/17","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/ocelotgraphql/ios/pulls/comments/238777479"},"html":{"href":"https://github.com/ocelotgraphql/ios/pull/17#discussion_r238777479"},"pull_request":{"href":"https://api.github.com/repos/ocelotgraphql/ios/pulls/17"}},"in_reply_to_id":238775725},"pull_request":{"url":"https://api.github.com/repos/ocelotgraphql/ios/pulls/17","id":235897748,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM1ODk3NzQ4","html_url":"https://github.com/ocelotgraphql/ios/pull/17","diff_url":"https://github.com/ocelotgraphql/ios/pull/17.diff","patch_url":"https://github.com/ocelotgraphql/ios/pull/17.patch","issue_url":"https://api.github.com/repos/ocelotgraphql/ios/issues/17","number":17,"state":"open","locked":false,"title":"Add Playground module and UIDocument subclass","user":{"login":"slashmo","id":16192401,"node_id":"MDQ6VXNlcjE2MTkyNDAx","avatar_url":"https://avatars3.githubusercontent.com/u/16192401?v=4","gravatar_id":"","url":"https://api.github.com/users/slashmo","html_url":"https://github.com/slashmo","followers_url":"https://api.github.com/users/slashmo/followers","following_url":"https://api.github.com/users/slashmo/following{/other_user}","gists_url":"https://api.github.com/users/slashmo/gists{/gist_id}","starred_url":"https://api.github.com/users/slashmo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slashmo/subscriptions","organizations_url":"https://api.github.com/users/slashmo/orgs","repos_url":"https://api.github.com/users/slashmo/repos","events_url":"https://api.github.com/users/slashmo/events{/privacy}","received_events_url":"https://api.github.com/users/slashmo/received_events","type":"User","site_admin":false},"body":"- Closes #16 ","created_at":"2018-12-04T17:35:38Z","updated_at":"2018-12-04T18:11:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"346b62a3f8043ed687b49f9d5bbc6603b21e3852","assignee":{"login":"slashmo","id":16192401,"node_id":"MDQ6VXNlcjE2MTkyNDAx","avatar_url":"https://avatars3.githubusercontent.com/u/16192401?v=4","gravatar_id":"","url":"https://api.github.com/users/slashmo","html_url":"https://github.com/slashmo","followers_url":"https://api.github.com/users/slashmo/followers","following_url":"https://api.github.com/users/slashmo/following{/other_user}","gists_url":"https://api.github.com/users/slashmo/gists{/gist_id}","starred_url":"https://api.github.com/users/slashmo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slashmo/subscriptions","organizations_url":"https://api.github.com/users/slashmo/orgs","repos_url":"https://api.github.com/users/slashmo/repos","events_url":"https://api.github.com/users/slashmo/events{/privacy}","received_events_url":"https://api.github.com/users/slashmo/received_events","type":"User","site_admin":false},"assignees":[{"login":"slashmo","id":16192401,"node_id":"MDQ6VXNlcjE2MTkyNDAx","avatar_url":"https://avatars3.githubusercontent.com/u/16192401?v=4","gravatar_id":"","url":"https://api.github.com/users/slashmo","html_url":"https://github.com/slashmo","followers_url":"https://api.github.com/users/slashmo/followers","following_url":"https://api.github.com/users/slashmo/following{/other_user}","gists_url":"https://api.github.com/users/slashmo/gists{/gist_id}","starred_url":"https://api.github.com/users/slashmo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slashmo/subscriptions","organizations_url":"https://api.github.com/users/slashmo/orgs","repos_url":"https://api.github.com/users/slashmo/repos","events_url":"https://api.github.com/users/slashmo/events{/privacy}","received_events_url":"https://api.github.com/users/slashmo/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":1145847844,"node_id":"MDU6TGFiZWwxMTQ1ODQ3ODQ0","url":"https://api.github.com/repos/ocelotgraphql/ios/labels/app","name":"app","color":"c3fcae","default":false},{"id":1148689677,"node_id":"MDU6TGFiZWwxMTQ4Njg5Njc3","url":"https://api.github.com/repos/ocelotgraphql/ios/labels/playground","name":"playground","color":"5067ba","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/ocelotgraphql/ios/pulls/17/commits","review_comments_url":"https://api.github.com/repos/ocelotgraphql/ios/pulls/17/comments","review_comment_url":"https://api.github.com/repos/ocelotgraphql/ios/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ocelotgraphql/ios/issues/17/comments","statuses_url":"https://api.github.com/repos/ocelotgraphql/ios/statuses/4e90ac7a523fb359641ee702c0c6d0586b328744","head":{"label":"ocelotgraphql:feature/playground","ref":"feature/playground","sha":"4e90ac7a523fb359641ee702c0c6d0586b328744","user":{"login":"ocelotgraphql","id":39314581,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM5MzE0NTgx","avatar_url":"https://avatars1.githubusercontent.com/u/39314581?v=4","gravatar_id":"","url":"https://api.github.com/users/ocelotgraphql","html_url":"https://github.com/ocelotgraphql","followers_url":"https://api.github.com/users/ocelotgraphql/followers","following_url":"https://api.github.com/users/ocelotgraphql/following{/other_user}","gists_url":"https://api.github.com/users/ocelotgraphql/gists{/gist_id}","starred_url":"https://api.github.com/users/ocelotgraphql/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ocelotgraphql/subscriptions","organizations_url":"https://api.github.com/users/ocelotgraphql/orgs","repos_url":"https://api.github.com/users/ocelotgraphql/repos","events_url":"https://api.github.com/users/ocelotgraphql/events{/privacy}","received_events_url":"https://api.github.com/users/ocelotgraphql/received_events","type":"Organization","site_admin":false},"repo":{"id":158760417,"node_id":"MDEwOlJlcG9zaXRvcnkxNTg3NjA0MTc=","name":"ios","full_name":"ocelotgraphql/ios","private":false,"owner":{"login":"ocelotgraphql","id":39314581,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM5MzE0NTgx","avatar_url":"https://avatars1.githubusercontent.com/u/39314581?v=4","gravatar_id":"","url":"https://api.github.com/users/ocelotgraphql","html_url":"https://github.com/ocelotgraphql","followers_url":"https://api.github.com/users/ocelotgraphql/followers","following_url":"https://api.github.com/users/ocelotgraphql/following{/other_user}","gists_url":"https://api.github.com/users/ocelotgraphql/gists{/gist_id}","starred_url":"https://api.github.com/users/ocelotgraphql/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ocelotgraphql/subscriptions","organizations_url":"https://api.github.com/users/ocelotgraphql/orgs","repos_url":"https://api.github.com/users/ocelotgraphql/repos","events_url":"https://api.github.com/users/ocelotgraphql/events{/privacy}","received_events_url":"https://api.github.com/users/ocelotgraphql/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/ocelotgraphql/ios","description":"🎡👆 GraphQL at your fingertips","fork":false,"url":"https://api.github.com/repos/ocelotgraphql/ios","forks_url":"https://api.github.com/repos/ocelotgraphql/ios/forks","keys_url":"https://api.github.com/repos/ocelotgraphql/ios/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ocelotgraphql/ios/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ocelotgraphql/ios/teams","hooks_url":"https://api.github.com/repos/ocelotgraphql/ios/hooks","issue_events_url":"https://api.github.com/repos/ocelotgraphql/ios/issues/events{/number}","events_url":"https://api.github.com/repos/ocelotgraphql/ios/events","assignees_url":"https://api.github.com/repos/ocelotgraphql/ios/assignees{/user}","branches_url":"https://api.github.com/repos/ocelotgraphql/ios/branches{/branch}","tags_url":"https://api.github.com/repos/ocelotgraphql/ios/tags","blobs_url":"https://api.github.com/repos/ocelotgraphql/ios/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ocelotgraphql/ios/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ocelotgraphql/ios/git/refs{/sha}","trees_url":"https://api.github.com/repos/ocelotgraphql/ios/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ocelotgraphql/ios/statuses/{sha}","languages_url":"https://api.github.com/repos/ocelotgraphql/ios/languages","stargazers_url":"https://api.github.com/repos/ocelotgraphql/ios/stargazers","contributors_url":"https://api.github.com/repos/ocelotgraphql/ios/contributors","subscribers_url":"https://api.github.com/repos/ocelotgraphql/ios/subscribers","subscription_url":"https://api.github.com/repos/ocelotgraphql/ios/subscription","commits_url":"https://api.github.com/repos/ocelotgraphql/ios/commits{/sha}","git_commits_url":"https://api.github.com/repos/ocelotgraphql/ios/git/commits{/sha}","comments_url":"https://api.github.com/repos/ocelotgraphql/ios/comments{/number}","issue_comment_url":"https://api.github.com/repos/ocelotgraphql/ios/issues/comments{/number}","contents_url":"https://api.github.com/repos/ocelotgraphql/ios/contents/{+path}","compare_url":"https://api.github.com/repos/ocelotgraphql/ios/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ocelotgraphql/ios/merges","archive_url":"https://api.github.com/repos/ocelotgraphql/ios/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ocelotgraphql/ios/downloads","issues_url":"https://api.github.com/repos/ocelotgraphql/ios/issues{/number}","pulls_url":"https://api.github.com/repos/ocelotgraphql/ios/pulls{/number}","milestones_url":"https://api.github.com/repos/ocelotgraphql/ios/milestones{/number}","notifications_url":"https://api.github.com/repos/ocelotgraphql/ios/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ocelotgraphql/ios/labels{/name}","releases_url":"https://api.github.com/repos/ocelotgraphql/ios/releases{/id}","deployments_url":"https://api.github.com/repos/ocelotgraphql/ios/deployments","created_at":"2018-11-22T23:56:04Z","updated_at":"2018-12-02T20:32:40Z","pushed_at":"2018-12-04T17:35:39Z","git_url":"git://github.com/ocelotgraphql/ios.git","ssh_url":"git@github.com:ocelotgraphql/ios.git","clone_url":"https://github.com/ocelotgraphql/ios.git","svn_url":"https://github.com/ocelotgraphql/ios","homepage":"https://ocelotgraphql.com","size":223,"stargazers_count":3,"watchers_count":3,"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":3,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":3,"watchers":3,"default_branch":"master"}},"base":{"label":"ocelotgraphql:master","ref":"master","sha":"0dbbd82d95cd2d2302a743af1fa802aa4441ce46","user":{"login":"ocelotgraphql","id":39314581,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM5MzE0NTgx","avatar_url":"https://avatars1.githubusercontent.com/u/39314581?v=4","gravatar_id":"","url":"https://api.github.com/users/ocelotgraphql","html_url":"https://github.com/ocelotgraphql","followers_url":"https://api.github.com/users/ocelotgraphql/followers","following_url":"https://api.github.com/users/ocelotgraphql/following{/other_user}","gists_url":"https://api.github.com/users/ocelotgraphql/gists{/gist_id}","starred_url":"https://api.github.com/users/ocelotgraphql/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ocelotgraphql/subscriptions","organizations_url":"https://api.github.com/users/ocelotgraphql/orgs","repos_url":"https://api.github.com/users/ocelotgraphql/repos","events_url":"https://api.github.com/users/ocelotgraphql/events{/privacy}","received_events_url":"https://api.github.com/users/ocelotgraphql/received_events","type":"Organization","site_admin":false},"repo":{"id":158760417,"node_id":"MDEwOlJlcG9zaXRvcnkxNTg3NjA0MTc=","name":"ios","full_name":"ocelotgraphql/ios","private":false,"owner":{"login":"ocelotgraphql","id":39314581,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM5MzE0NTgx","avatar_url":"https://avatars1.githubusercontent.com/u/39314581?v=4","gravatar_id":"","url":"https://api.github.com/users/ocelotgraphql","html_url":"https://github.com/ocelotgraphql","followers_url":"https://api.github.com/users/ocelotgraphql/followers","following_url":"https://api.github.com/users/ocelotgraphql/following{/other_user}","gists_url":"https://api.github.com/users/ocelotgraphql/gists{/gist_id}","starred_url":"https://api.github.com/users/ocelotgraphql/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ocelotgraphql/subscriptions","organizations_url":"https://api.github.com/users/ocelotgraphql/orgs","repos_url":"https://api.github.com/users/ocelotgraphql/repos","events_url":"https://api.github.com/users/ocelotgraphql/events{/privacy}","received_events_url":"https://api.github.com/users/ocelotgraphql/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/ocelotgraphql/ios","description":"🎡👆 GraphQL at your fingertips","fork":false,"url":"https://api.github.com/repos/ocelotgraphql/ios","forks_url":"https://api.github.com/repos/ocelotgraphql/ios/forks","keys_url":"https://api.github.com/repos/ocelotgraphql/ios/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ocelotgraphql/ios/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ocelotgraphql/ios/teams","hooks_url":"https://api.github.com/repos/ocelotgraphql/ios/hooks","issue_events_url":"https://api.github.com/repos/ocelotgraphql/ios/issues/events{/number}","events_url":"https://api.github.com/repos/ocelotgraphql/ios/events","assignees_url":"https://api.github.com/repos/ocelotgraphql/ios/assignees{/user}","branches_url":"https://api.github.com/repos/ocelotgraphql/ios/branches{/branch}","tags_url":"https://api.github.com/repos/ocelotgraphql/ios/tags","blobs_url":"https://api.github.com/repos/ocelotgraphql/ios/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ocelotgraphql/ios/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ocelotgraphql/ios/git/refs{/sha}","trees_url":"https://api.github.com/repos/ocelotgraphql/ios/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ocelotgraphql/ios/statuses/{sha}","languages_url":"https://api.github.com/repos/ocelotgraphql/ios/languages","stargazers_url":"https://api.github.com/repos/ocelotgraphql/ios/stargazers","contributors_url":"https://api.github.com/repos/ocelotgraphql/ios/contributors","subscribers_url":"https://api.github.com/repos/ocelotgraphql/ios/subscribers","subscription_url":"https://api.github.com/repos/ocelotgraphql/ios/subscription","commits_url":"https://api.github.com/repos/ocelotgraphql/ios/commits{/sha}","git_commits_url":"https://api.github.com/repos/ocelotgraphql/ios/git/commits{/sha}","comments_url":"https://api.github.com/repos/ocelotgraphql/ios/comments{/number}","issue_comment_url":"https://api.github.com/repos/ocelotgraphql/ios/issues/comments{/number}","contents_url":"https://api.github.com/repos/ocelotgraphql/ios/contents/{+path}","compare_url":"https://api.github.com/repos/ocelotgraphql/ios/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ocelotgraphql/ios/merges","archive_url":"https://api.github.com/repos/ocelotgraphql/ios/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ocelotgraphql/ios/downloads","issues_url":"https://api.github.com/repos/ocelotgraphql/ios/issues{/number}","pulls_url":"https://api.github.com/repos/ocelotgraphql/ios/pulls{/number}","milestones_url":"https://api.github.com/repos/ocelotgraphql/ios/milestones{/number}","notifications_url":"https://api.github.com/repos/ocelotgraphql/ios/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ocelotgraphql/ios/labels{/name}","releases_url":"https://api.github.com/repos/ocelotgraphql/ios/releases{/id}","deployments_url":"https://api.github.com/repos/ocelotgraphql/ios/deployments","created_at":"2018-11-22T23:56:04Z","updated_at":"2018-12-02T20:32:40Z","pushed_at":"2018-12-04T17:35:39Z","git_url":"git://github.com/ocelotgraphql/ios.git","ssh_url":"git@github.com:ocelotgraphql/ios.git","clone_url":"https://github.com/ocelotgraphql/ios.git","svn_url":"https://github.com/ocelotgraphql/ios","homepage":"https://ocelotgraphql.com","size":223,"stargazers_count":3,"watchers_count":3,"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":3,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":3,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ocelotgraphql/ios/pulls/17"},"html":{"href":"https://github.com/ocelotgraphql/ios/pull/17"},"issue":{"href":"https://api.github.com/repos/ocelotgraphql/ios/issues/17"},"comments":{"href":"https://api.github.com/repos/ocelotgraphql/ios/issues/17/comments"},"review_comments":{"href":"https://api.github.com/repos/ocelotgraphql/ios/pulls/17/comments"},"review_comment":{"href":"https://api.github.com/repos/ocelotgraphql/ios/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ocelotgraphql/ios/pulls/17/commits"},"statuses":{"href":"https://api.github.com/repos/ocelotgraphql/ios/statuses/4e90ac7a523fb359641ee702c0c6d0586b328744"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"slashmo"}}