{"action":"created","comment":{"url":"https://api.github.com/repos/xitu/gold-miner/pulls/comments/190586722","pull_request_review_id":122984785,"id":190586722,"diff_hunk":"@@ -316,41 +316,41 @@ controller.view.frame.size = CGSize(width: 375, height: 667)\n PlaygroundPage.current.liveView = controller.view\n ```\n \n-Wait a bit for the Playground to finish running. Oops. Things are not so great in the Playground, it does not recognise the images and localised strings 😢\n+等待 Playground 运行完成。哎呀。在 Playground 中并不是那么好，它不能识别图像和本地化的字符串。😢\n \n ![](https://cdn-images-1.medium.com/max/800/1*Vgzy7nGWLfnydX3SOjmD4Q.png)\n \n-#### Resources folder\n+#### Resources 文件夹\n \n-Actually each `Playground Page` has a `Resources` folder where we can put resource files that is seen by this particular page. But here we need to access resource in our app bundle.\n+实际上，每个 `Playground Page` 中都有一个 `Resources` 文件夹，我们可以在其中放置这个特定页面所看到的资源文件。但是，我们需要访问应用程序包中的资源。\n \n #### Main bundle\n \n-When accessing image and localised string, if you don’t specify `bundle` , the running app will by default pick up the resources in the main bundle. Here is more info [Finding and Opening a Bundle](https://developer.apple.com/documentation/foundation/bundle).\n+当访问图像和本地化字符串时，如果你不指定 `bundle`，正在运行的应用将默认选取 Main bundle 中的资源。以下是更多关于[查找和打开 Bundle](https://developer.apple.com/documentation/foundation/bundle) 的更多信息。\n \n-> Before you can locate a resource, you must first specify which bundle contains it. The `Bundle`class has many constructors, but the one you use most often is `[main](https://developer.apple.com/documentation/foundation/bundle/1410786-main)`. The main bundle represents the bundle directory that contains the currently executing code. So for an app, the main bundle object gives you access to the resources that shipped with your app.\n+> 在找到资源之前，必须先指定包含该资源的 bundle。`Bundle` 类中有许多构造函数，但是最常用的是 `[main](https://developer.apple.com/documentation/foundation/bundle/1410786-main)` 函数。Main bundle 表示包含当前正在执行的代码的包目录。因此对于应用，Main bundle 对象可以让你访问与应用一起发布的资源。\n \n-> If your app interacts directly with plug-ins, frameworks, or other bundled content, you can use other methods of this class to create appropriate bundle objects.\n+> 如果应用直接与插件、框架或其他 bundle 内容交互，则可以使用此类的其他方法创建适当的 bundle 对象。\n \n ```\n-// Get the app's main bundle\n+//获取应用的 main bundle\n let mainBundle = Bundle.main\n \n-// Get the bundle containing the specified private class.\n+// 获取包含指定私有类的 bundle\n let myBundle = Bundle(for: NSClassFromString(\"MyPrivateClass\")!)\n ```\n \n-#### Step 1: Adding resources to AppFramework target\n+#### 步骤 1：在 AppFramework target 中添加资源\n \n-So firstly, we need to add resource files to our AppFramework target. Select `Asset Catalog` and `Localizable.strings` and add them to our `AppFramework` target.\n+首先，我们需要在 AppFramework target 添加资源文件。选择 `Asset Catalog` 和 `Localizable.strings` 并将它们添加到 `AppFramework` target。\n \n ![](https://cdn-images-1.medium.com/max/800/1*mI2C1ode8HGlBe4-zp_5ew.png)\n \n-#### Step 2: Specifying bundle\n+#### 步骤 2：指定 bundle\n \n-If we don’t specify bundle, then by default `mainBundle` is used. In the context of the executed Playground, `mainBundle` refers to the its `Resources` folder. But we want the Playground to access resources in the AppFramework, so we need to use`[Bundle.nit(for:)](https://developer.apple.com/documentation/foundation/bundle/1417717-init)` with a class in `AppFramework` to refer to the bundle inside `AppFramework`. That class can be `ResourceViewController` as it is added to `AppFramework` target too.\n+如果我们不指定 bundle，那么默认会使用 `mainBundle`。在执行的 Playground 的上下文中，`mainBundle` 指的是其 `Resources` 文件夹。但我们希望 Playground 访问 AppFramework 中的资源，所以我们需要在 `AppFramework` 中使用一个类调用 `[Bundle.nit(for:)](https://developer.apple.com/documentation/foundation/bundle/1417717-init)` 方法来引用 `AppFramework` 中的 bundle。该类可以是 `ResourceViewController`，因为它也被添加到 `AppFramework` target 中。","path":"TODO1/playground-driven-development-in-swift.md","position":379,"original_position":379,"commit_id":"b223a6a621d9e2938e3b3a360cafdba4ed66f4c8","original_commit_id":"b223a6a621d9e2938e3b3a360cafdba4ed66f4c8","user":{"login":"talisk","id":7621572,"avatar_url":"https://avatars0.githubusercontent.com/u/7621572?v=4","gravatar_id":"","url":"https://api.github.com/users/talisk","html_url":"https://github.com/talisk","followers_url":"https://api.github.com/users/talisk/followers","following_url":"https://api.github.com/users/talisk/following{/other_user}","gists_url":"https://api.github.com/users/talisk/gists{/gist_id}","starred_url":"https://api.github.com/users/talisk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/talisk/subscriptions","organizations_url":"https://api.github.com/users/talisk/orgs","repos_url":"https://api.github.com/users/talisk/repos","events_url":"https://api.github.com/users/talisk/events{/privacy}","received_events_url":"https://api.github.com/users/talisk/received_events","type":"User","site_admin":false},"body":"『Bundle.nit(for:)』应该是『Bundle.init(for:)』方法，建议加一个『译者注：原文有误』","created_at":"2018-05-24T13:32:58Z","updated_at":"2018-05-24T13:35:58Z","html_url":"https://github.com/xitu/gold-miner/pull/3850#discussion_r190586722","pull_request_url":"https://api.github.com/repos/xitu/gold-miner/pulls/3850","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/xitu/gold-miner/pulls/comments/190586722"},"html":{"href":"https://github.com/xitu/gold-miner/pull/3850#discussion_r190586722"},"pull_request":{"href":"https://api.github.com/repos/xitu/gold-miner/pulls/3850"}}},"pull_request":{"url":"https://api.github.com/repos/xitu/gold-miner/pulls/3850","id":188759313,"html_url":"https://github.com/xitu/gold-miner/pull/3850","diff_url":"https://github.com/xitu/gold-miner/pull/3850.diff","patch_url":"https://github.com/xitu/gold-miner/pull/3850.patch","issue_url":"https://api.github.com/repos/xitu/gold-miner/issues/3850","number":3850,"state":"open","locked":false,"title":" Swift 中的 Playground 驱动开发","user":{"login":"ALVINYEH","id":17822315,"avatar_url":"https://avatars3.githubusercontent.com/u/17822315?v=4","gravatar_id":"","url":"https://api.github.com/users/ALVINYEH","html_url":"https://github.com/ALVINYEH","followers_url":"https://api.github.com/users/ALVINYEH/followers","following_url":"https://api.github.com/users/ALVINYEH/following{/other_user}","gists_url":"https://api.github.com/users/ALVINYEH/gists{/gist_id}","starred_url":"https://api.github.com/users/ALVINYEH/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ALVINYEH/subscriptions","organizations_url":"https://api.github.com/users/ALVINYEH/orgs","repos_url":"https://api.github.com/users/ALVINYEH/repos","events_url":"https://api.github.com/users/ALVINYEH/events{/privacy}","received_events_url":"https://api.github.com/users/ALVINYEH/received_events","type":"User","site_admin":false},"body":"译文翻译完成，resolve #3838 ","created_at":"2018-05-17T14:37:40Z","updated_at":"2018-05-24T13:35:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cbad55a893dd21972bde8c8da9b063e9d3932d71","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":514335487,"url":"https://api.github.com/repos/xitu/gold-miner/labels/iOS","name":"iOS","color":"1d76db","default":false},{"id":810553072,"url":"https://api.github.com/repos/xitu/gold-miner/labels/%E6%A0%87%E6%B3%A8","name":"标注","color":"fdcf66","default":false},{"id":322084033,"url":"https://api.github.com/repos/xitu/gold-miner/labels/%E6%AD%A3%E5%9C%A8%E6%A0%A1%E5%AF%B9","name":"正在校对","color":"c2e0c6","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/xitu/gold-miner/pulls/3850/commits","review_comments_url":"https://api.github.com/repos/xitu/gold-miner/pulls/3850/comments","review_comment_url":"https://api.github.com/repos/xitu/gold-miner/pulls/comments{/number}","comments_url":"https://api.github.com/repos/xitu/gold-miner/issues/3850/comments","statuses_url":"https://api.github.com/repos/xitu/gold-miner/statuses/b223a6a621d9e2938e3b3a360cafdba4ed66f4c8","head":{"label":"ALVINYEH:translation/playground-driven-development-in-swift.md","ref":"translation/playground-driven-development-in-swift.md","sha":"b223a6a621d9e2938e3b3a360cafdba4ed66f4c8","user":{"login":"ALVINYEH","id":17822315,"avatar_url":"https://avatars3.githubusercontent.com/u/17822315?v=4","gravatar_id":"","url":"https://api.github.com/users/ALVINYEH","html_url":"https://github.com/ALVINYEH","followers_url":"https://api.github.com/users/ALVINYEH/followers","following_url":"https://api.github.com/users/ALVINYEH/following{/other_user}","gists_url":"https://api.github.com/users/ALVINYEH/gists{/gist_id}","starred_url":"https://api.github.com/users/ALVINYEH/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ALVINYEH/subscriptions","organizations_url":"https://api.github.com/users/ALVINYEH/orgs","repos_url":"https://api.github.com/users/ALVINYEH/repos","events_url":"https://api.github.com/users/ALVINYEH/events{/privacy}","received_events_url":"https://api.github.com/users/ALVINYEH/received_events","type":"User","site_admin":false},"repo":{"id":129020931,"name":"gold-miner","full_name":"ALVINYEH/gold-miner","owner":{"login":"ALVINYEH","id":17822315,"avatar_url":"https://avatars3.githubusercontent.com/u/17822315?v=4","gravatar_id":"","url":"https://api.github.com/users/ALVINYEH","html_url":"https://github.com/ALVINYEH","followers_url":"https://api.github.com/users/ALVINYEH/followers","following_url":"https://api.github.com/users/ALVINYEH/following{/other_user}","gists_url":"https://api.github.com/users/ALVINYEH/gists{/gist_id}","starred_url":"https://api.github.com/users/ALVINYEH/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ALVINYEH/subscriptions","organizations_url":"https://api.github.com/users/ALVINYEH/orgs","repos_url":"https://api.github.com/users/ALVINYEH/repos","events_url":"https://api.github.com/users/ALVINYEH/events{/privacy}","received_events_url":"https://api.github.com/users/ALVINYEH/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ALVINYEH/gold-miner","description":"🥇掘金翻译计划，可能是世界最大最好的英译中技术社区，最懂读者和译者的翻译平台：","fork":true,"url":"https://api.github.com/repos/ALVINYEH/gold-miner","forks_url":"https://api.github.com/repos/ALVINYEH/gold-miner/forks","keys_url":"https://api.github.com/repos/ALVINYEH/gold-miner/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ALVINYEH/gold-miner/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ALVINYEH/gold-miner/teams","hooks_url":"https://api.github.com/repos/ALVINYEH/gold-miner/hooks","issue_events_url":"https://api.github.com/repos/ALVINYEH/gold-miner/issues/events{/number}","events_url":"https://api.github.com/repos/ALVINYEH/gold-miner/events","assignees_url":"https://api.github.com/repos/ALVINYEH/gold-miner/assignees{/user}","branches_url":"https://api.github.com/repos/ALVINYEH/gold-miner/branches{/branch}","tags_url":"https://api.github.com/repos/ALVINYEH/gold-miner/tags","blobs_url":"https://api.github.com/repos/ALVINYEH/gold-miner/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ALVINYEH/gold-miner/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ALVINYEH/gold-miner/git/refs{/sha}","trees_url":"https://api.github.com/repos/ALVINYEH/gold-miner/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ALVINYEH/gold-miner/statuses/{sha}","languages_url":"https://api.github.com/repos/ALVINYEH/gold-miner/languages","stargazers_url":"https://api.github.com/repos/ALVINYEH/gold-miner/stargazers","contributors_url":"https://api.github.com/repos/ALVINYEH/gold-miner/contributors","subscribers_url":"https://api.github.com/repos/ALVINYEH/gold-miner/subscribers","subscription_url":"https://api.github.com/repos/ALVINYEH/gold-miner/subscription","commits_url":"https://api.github.com/repos/ALVINYEH/gold-miner/commits{/sha}","git_commits_url":"https://api.github.com/repos/ALVINYEH/gold-miner/git/commits{/sha}","comments_url":"https://api.github.com/repos/ALVINYEH/gold-miner/comments{/number}","issue_comment_url":"https://api.github.com/repos/ALVINYEH/gold-miner/issues/comments{/number}","contents_url":"https://api.github.com/repos/ALVINYEH/gold-miner/contents/{+path}","compare_url":"https://api.github.com/repos/ALVINYEH/gold-miner/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ALVINYEH/gold-miner/merges","archive_url":"https://api.github.com/repos/ALVINYEH/gold-miner/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ALVINYEH/gold-miner/downloads","issues_url":"https://api.github.com/repos/ALVINYEH/gold-miner/issues{/number}","pulls_url":"https://api.github.com/repos/ALVINYEH/gold-miner/pulls{/number}","milestones_url":"https://api.github.com/repos/ALVINYEH/gold-miner/milestones{/number}","notifications_url":"https://api.github.com/repos/ALVINYEH/gold-miner/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ALVINYEH/gold-miner/labels{/name}","releases_url":"https://api.github.com/repos/ALVINYEH/gold-miner/releases{/id}","deployments_url":"https://api.github.com/repos/ALVINYEH/gold-miner/deployments","created_at":"2018-04-11T02:14:48Z","updated_at":"2018-05-16T03:48:32Z","pushed_at":"2018-05-21T08:27:09Z","git_url":"git://github.com/ALVINYEH/gold-miner.git","ssh_url":"git@github.com:ALVINYEH/gold-miner.git","clone_url":"https://github.com/ALVINYEH/gold-miner.git","svn_url":"https://github.com/ALVINYEH/gold-miner","homepage":"https://juejin.im/tag/掘金翻译计划","size":32716,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"xitu:master","ref":"master","sha":"992672ad26fdb3197a5c62c8d1f14fe0401c8ab6","user":{"login":"xitu","id":10482599,"avatar_url":"https://avatars2.githubusercontent.com/u/10482599?v=4","gravatar_id":"","url":"https://api.github.com/users/xitu","html_url":"https://github.com/xitu","followers_url":"https://api.github.com/users/xitu/followers","following_url":"https://api.github.com/users/xitu/following{/other_user}","gists_url":"https://api.github.com/users/xitu/gists{/gist_id}","starred_url":"https://api.github.com/users/xitu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xitu/subscriptions","organizations_url":"https://api.github.com/users/xitu/orgs","repos_url":"https://api.github.com/users/xitu/repos","events_url":"https://api.github.com/users/xitu/events{/privacy}","received_events_url":"https://api.github.com/users/xitu/received_events","type":"Organization","site_admin":false},"repo":{"id":45512989,"name":"gold-miner","full_name":"xitu/gold-miner","owner":{"login":"xitu","id":10482599,"avatar_url":"https://avatars2.githubusercontent.com/u/10482599?v=4","gravatar_id":"","url":"https://api.github.com/users/xitu","html_url":"https://github.com/xitu","followers_url":"https://api.github.com/users/xitu/followers","following_url":"https://api.github.com/users/xitu/following{/other_user}","gists_url":"https://api.github.com/users/xitu/gists{/gist_id}","starred_url":"https://api.github.com/users/xitu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xitu/subscriptions","organizations_url":"https://api.github.com/users/xitu/orgs","repos_url":"https://api.github.com/users/xitu/repos","events_url":"https://api.github.com/users/xitu/events{/privacy}","received_events_url":"https://api.github.com/users/xitu/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/xitu/gold-miner","description":"🥇掘金翻译计划，可能是世界最大最好的英译中技术社区，最懂读者和译者的翻译平台：","fork":false,"url":"https://api.github.com/repos/xitu/gold-miner","forks_url":"https://api.github.com/repos/xitu/gold-miner/forks","keys_url":"https://api.github.com/repos/xitu/gold-miner/keys{/key_id}","collaborators_url":"https://api.github.com/repos/xitu/gold-miner/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/xitu/gold-miner/teams","hooks_url":"https://api.github.com/repos/xitu/gold-miner/hooks","issue_events_url":"https://api.github.com/repos/xitu/gold-miner/issues/events{/number}","events_url":"https://api.github.com/repos/xitu/gold-miner/events","assignees_url":"https://api.github.com/repos/xitu/gold-miner/assignees{/user}","branches_url":"https://api.github.com/repos/xitu/gold-miner/branches{/branch}","tags_url":"https://api.github.com/repos/xitu/gold-miner/tags","blobs_url":"https://api.github.com/repos/xitu/gold-miner/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/xitu/gold-miner/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/xitu/gold-miner/git/refs{/sha}","trees_url":"https://api.github.com/repos/xitu/gold-miner/git/trees{/sha}","statuses_url":"https://api.github.com/repos/xitu/gold-miner/statuses/{sha}","languages_url":"https://api.github.com/repos/xitu/gold-miner/languages","stargazers_url":"https://api.github.com/repos/xitu/gold-miner/stargazers","contributors_url":"https://api.github.com/repos/xitu/gold-miner/contributors","subscribers_url":"https://api.github.com/repos/xitu/gold-miner/subscribers","subscription_url":"https://api.github.com/repos/xitu/gold-miner/subscription","commits_url":"https://api.github.com/repos/xitu/gold-miner/commits{/sha}","git_commits_url":"https://api.github.com/repos/xitu/gold-miner/git/commits{/sha}","comments_url":"https://api.github.com/repos/xitu/gold-miner/comments{/number}","issue_comment_url":"https://api.github.com/repos/xitu/gold-miner/issues/comments{/number}","contents_url":"https://api.github.com/repos/xitu/gold-miner/contents/{+path}","compare_url":"https://api.github.com/repos/xitu/gold-miner/compare/{base}...{head}","merges_url":"https://api.github.com/repos/xitu/gold-miner/merges","archive_url":"https://api.github.com/repos/xitu/gold-miner/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/xitu/gold-miner/downloads","issues_url":"https://api.github.com/repos/xitu/gold-miner/issues{/number}","pulls_url":"https://api.github.com/repos/xitu/gold-miner/pulls{/number}","milestones_url":"https://api.github.com/repos/xitu/gold-miner/milestones{/number}","notifications_url":"https://api.github.com/repos/xitu/gold-miner/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/xitu/gold-miner/labels{/name}","releases_url":"https://api.github.com/repos/xitu/gold-miner/releases{/id}","deployments_url":"https://api.github.com/repos/xitu/gold-miner/deployments","created_at":"2015-11-04T03:29:13Z","updated_at":"2018-05-24T13:06:07Z","pushed_at":"2018-05-24T11:03:48Z","git_url":"git://github.com/xitu/gold-miner.git","ssh_url":"git@github.com:xitu/gold-miner.git","clone_url":"https://github.com/xitu/gold-miner.git","svn_url":"https://github.com/xitu/gold-miner","homepage":"https://juejin.im/tag/掘金翻译计划","size":32878,"stargazers_count":14035,"watchers_count":14035,"language":null,"has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2470,"mirror_url":null,"archived":false,"open_issues_count":34,"license":null,"forks":2470,"open_issues":34,"watchers":14035,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/xitu/gold-miner/pulls/3850"},"html":{"href":"https://github.com/xitu/gold-miner/pull/3850"},"issue":{"href":"https://api.github.com/repos/xitu/gold-miner/issues/3850"},"comments":{"href":"https://api.github.com/repos/xitu/gold-miner/issues/3850/comments"},"review_comments":{"href":"https://api.github.com/repos/xitu/gold-miner/pulls/3850/comments"},"review_comment":{"href":"https://api.github.com/repos/xitu/gold-miner/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/xitu/gold-miner/pulls/3850/commits"},"statuses":{"href":"https://api.github.com/repos/xitu/gold-miner/statuses/b223a6a621d9e2938e3b3a360cafdba4ed66f4c8"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"talisk"}}