{"id":4109,"date":"2025-06-02T14:04:06","date_gmt":"2025-06-04T06:07:06","guid":{"rendered":"https:\/\/badgameshow.com\/steven\/?p=4109"},"modified":"2025-06-04T14:04:06","modified_gmt":"2025-06-04T06:07:06","slug":"%e5%ad%b8%e7%bf%92swift%e4%b8%ad%e7%9a%84%e3%80%8cexpectedindictionaryliteral%e3%80%8d%e9%8c%af%e8%aa%a4%e8%a7%a3%e6%9e%90","status":"publish","type":"post","link":"https:\/\/badgameshow.com\/steven\/swift\/%e5%ad%b8%e7%bf%92swift%e4%b8%ad%e7%9a%84%e3%80%8cexpectedindictionaryliteral%e3%80%8d%e9%8c%af%e8%aa%a4%e8%a7%a3%e6%9e%90\/","title":{"rendered":"\u6df1\u5165\u89e3\u6790 Swift \u932f\u8aa4\uff1a\u89e3\u6c7a\u300cExpected &#8216;:&#8217; in Dictionary Literal\u300d\u7684\u6700\u4f73\u65b9\u6cd5"},"content":{"rendered":"<p><meta name=\"keywords\" content=\"Swift, Expected ':', dictionary literal, Swift \u932f\u8aa4\u89e3\u6790, Python \u6559\u5b78\"><\/p>\n<h1>\u6df1\u5165\u89e3\u6790 Swift \u932f\u8aa4\uff1a\u89e3\u6c7a\u300cExpected &#8216;:&#8217; in Dictionary Literal\u300d\u7684\u6700\u4f73\u65b9\u6cd5<\/h1>\n<p>\u5728 Swift \u7a0b\u5f0f\u8a9e\u8a00\u4e2d\uff0c\u7531\u65bc\u5176\u7368\u7279\u7684\u8a9e\u6cd5\u8a2d\u8a08\uff0c\u958b\u767c\u8005\u7d93\u5e38\u6703\u9047\u5230\u5404\u7a2e\u932f\u8aa4\u3002\u5176\u4e2d\uff0c\u300cExpected &#8216;:&#8217; in dictionary literal\u300d\u932f\u8aa4\u662f\u4e00\u500b\u5e38\u898b\u7684\u554f\u984c\uff0c\u672c\u6587\u5c07\u70ba\u4f60\u8a73\u7d30\u89e3\u6790\u9019\u500b\u932f\u8aa4\u7684\u6210\u56e0\u53ca\u5176\u89e3\u6c7a\u65b9\u6848\uff0c\u52a9\u4f60\u66f4\u6709\u6548\u5730\u7de8\u5beb Swift \u7a0b\u5f0f\u3002<\/p>\n<h2>\u4ec0\u9ebc\u662f\u300cExpected &#8216;:&#8217; in Dictionary Literal\u300d\u932f\u8aa4\uff1f<\/h2>\n<p>\u300cExpected &#8216;:&#8217; in dictionary literal\u300d\u932f\u8aa4\u767c\u751f\u5728 Swift \u4e2d\u7684\u5b57\u5178\u5b57\u9762\u91cf\uff08dictionary literal\uff09\u8a9e\u6cd5\u4e0d\u6b63\u78ba\u6642\u3002\u5b57\u5178\u5b57\u9762\u91cf\u662f\u4e00\u7a2e\u7528\u4f86\u5132\u5b58\u9375\u503c\u5c0d\uff08key-value pairs\uff09\u7684\u8cc7\u6599\u7d50\u69cb\uff0c\u5176\u683c\u5f0f\u70ba\u300c\u9375\uff1a\u503c\u300d\u3002\u82e5\u7f3a\u5c11\u5192\u865f\uff08:\uff09\uff0c\u7de8\u8b6f\u5668\u5c07\u7121\u6cd5\u6b63\u78ba\u89e3\u6790\u5b57\u5178\uff0c\u5f9e\u800c\u5f15\u767c\u6b64\u932f\u8aa4\u3002<\/p>\n<h2>\u70ba\u4f55\u6703\u51fa\u73fe\u300cExpected &#8216;:&#8217; in Dictionary Literal\u300d\u932f\u8aa4\uff1f<\/h2>\n<p>\u6b64\u932f\u8aa4\u901a\u5e38\u662f\u56e0\u70ba\u5728\u5b9a\u7fa9\u5b57\u5178\u6642\uff0c\u958b\u767c\u8005\u4e0d\u5c0f\u5fc3\u7701\u7565\u4e86\u5192\u865f\u3002\u4f8b\u5982\uff0c\u7576\u4f60\u7684\u7a0b\u5f0f\u78bc\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<pre class=\"brush: swift\">\nlet dict = [\"key1\" \"value1\" \"key2\" \"value2\"]\n<\/pre>\n<p>\u9019\u5c07\u5c0e\u81f4\u7de8\u8b6f\u5668\u7121\u6cd5\u8b58\u5225\u5b57\u5178\u7684\u7d50\u69cb\uff0c\u56e0\u6b64\u6703\u5831\u544a\u300cExpected &#8216;:&#8217; in dictionary literal\u300d\u932f\u8aa4\u3002<\/p>\n<h2>\u5982\u4f55\u6709\u6548\u89e3\u6c7a\u300cExpected &#8216;:&#8217; in Dictionary Literal\u300d\u932f\u8aa4\uff1f<\/h2>\n<p>\u8981\u4fee\u6b63\u6b64\u932f\u8aa4\uff0c\u60a8\u53ea\u9700\u5728\u5b57\u5178\u5b57\u9762\u91cf\u4e2d\u6b63\u78ba\u6dfb\u52a0\u5192\u865f\u3002\u4ee5\u4e0b\u662f\u4fee\u6b63\u5f8c\u7684\u6b63\u78ba\u7bc4\u4f8b\uff1a<\/p>\n<pre class=\"brush: swift\">\nlet dict = [\"key1\": \"value1\", \"key2\": \"value2\"]\n<\/pre>\n<p>\u9019\u6a23\u4fee\u6539\u5f8c\uff0c\u7de8\u8b6f\u5668\u5c31\u80fd\u6b63\u78ba\u7406\u89e3\u5b57\u5178\u7684\u7d50\u69cb\uff0c\u5f9e\u800c\u6d88\u9664\u932f\u8aa4\u3002<\/p>\n<h2>\u7e3d\u7d50<\/h2>\n<p>\u300cExpected &#8216;:&#8217; in dictionary literal\u300d\u662f Swift \u958b\u767c\u904e\u7a0b\u4e2d\u5e38\u898b\u7684\u932f\u8aa4\u4e4b\u4e00\u3002\u7406\u89e3\u5176\u539f\u56e0\u4e26\u6b63\u78ba\u4f7f\u7528\u5b57\u5178\u5b57\u9762\u91cf\u7684\u8a9e\u6cd5\uff0c\u53ef\u4ee5\u6709\u6548\u907f\u514d\u6b64\u932f\u8aa4\u7684\u767c\u751f\u3002\u5e0c\u671b\u9019\u7bc7\u6587\u7ae0\u80fd\u5e6b\u52a9\u4f60\u5728\u7de8\u5beb Swift \u7a0b\u5f0f\u6642\u66f4\u52a0\u5f97\u5fc3\u61c9\u624b\uff0c\u63d0\u5347\u4f60\u7684\u7de8\u7a0b\u6280\u80fd\u3002<\/p>\n<p>\u5728 Swift \u7684\u5b78\u7fd2\u904e\u7a0b\u4e2d\uff0c\u985e\u4f3c\u7684\u8a9e\u6cd5\u932f\u8aa4\u7e3d\u662f\u6703\u4e0d\u6642\u51fa\u73fe\uff0c\u638c\u63e1\u89e3\u6c7a\u65b9\u6cd5\u662f\u6210\u70ba\u512a\u79c0\u958b\u767c\u8005\u7684\u5fc5\u7d93\u4e4b\u8def\u3002\u795d\u4f60\u7de8\u7a0b\u9806\u5229\uff01<\/p>\n<p>&#8212;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6458\u8981\uff1a\u672c\u6587\u5c07\u8a73\u7d30\u4ecb\u7d39Swift\u4e2d\u7684\u300cExpected&#8217;:&#8217;indictionaryliteral\u300d\u932f\u8aa4\uff0c\u4e26\u63d0\u4f9b\u89e3\u6c7a\u8a72\u932f\u8aa4\u7684\u65b9\u6cd5\uff0c\u8b93\u958b\u767c\u8005\u80fd\u5920\u66f4\u5feb\u901f\u5730\u89e3\u6c7a\u554f\u984c\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[174,5],"tags":[173,9],"class_list":["post-4109","post","type-post","status-publish","format-standard","hentry","category-ios","category-swift","tag-ios","tag-swift"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack-related-posts":[],"jetpack_shortlink":"https:\/\/wp.me\/pcFK27-14h","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/4109","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/comments?post=4109"}],"version-history":[{"count":1,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/4109\/revisions"}],"predecessor-version":[{"id":4110,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/4109\/revisions\/4110"}],"wp:attachment":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/media?parent=4109"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/categories?post=4109"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/tags?post=4109"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}