{"id":4151,"date":"2025-06-01T13:14:38","date_gmt":"2025-06-04T06:07:37","guid":{"rendered":"https:\/\/badgameshow.com\/steven\/?p=4151"},"modified":"2025-06-04T13:14:38","modified_gmt":"2025-06-04T06:07:37","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-2","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-2\/","title":{"rendered":"\u6df1\u5165\u89e3\u6790 Swift \u932f\u8aa4\uff1a\u300cExpected &#8216;:&#8217; in Dictionary Literal\u300d\u53ca\u89e3\u6c7a\u65b9\u6848"},"content":{"rendered":"<p><meta name=\"keywords\" content=\"Swift, Expected ':', dictionary literal, Swift \u932f\u8aa4\u89e3\u6790, \u7a0b\u5f0f\u8a9e\u8a00\u6559\u5b78\"><\/p>\n<h1>\u6df1\u5165\u89e3\u6790 Swift \u932f\u8aa4\uff1a\u300cExpected &#8216;:&#8217; in Dictionary Literal\u300d\u53ca\u89e3\u6c7a\u65b9\u6848<\/h1>\n<p>Swift \u9019\u7a2e\u73fe\u4ee3\u7a0b\u5f0f\u8a9e\u8a00\u4ee5\u5176\u7c21\u6f54\u4e14\u5b89\u5168\u7684\u8a9e\u6cd5\u53d7\u5230\u5ee3\u6cdb\u6b61\u8fce\uff0c\u4f46\u5728\u958b\u767c\u904e\u7a0b\u4e2d\uff0c\u958b\u767c\u8005\u7d93\u5e38\u6703\u9047\u5230\u5404\u7a2e\u932f\u8aa4\u8a0a\u606f\uff0c\u5176\u4e2d\u300cExpected &#8216;:&#8217; in dictionary literal\u300d\u932f\u8aa4\u5c24\u70ba\u5e38\u898b\u3002\u672c\u6587\u5c07\u8a73\u7d30\u89e3\u91cb\u9019\u500b\u932f\u8aa4\u7684\u6839\u672c\u539f\u56e0\uff0c\u4e26\u63d0\u4f9b\u5177\u9ad4\u7684\u89e3\u6c7a\u65b9\u6cd5\uff0c\u4ee5\u5e6b\u52a9\u60a8\u5feb\u901f\u514b\u670d\u9019\u4e00\u969c\u7919\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\u662f\u4e00\u7a2e\u8a9e\u6cd5\u932f\u8aa4\uff0c\u8868\u793a\u5728 Swift \u7a0b\u5f0f\u78bc\u4e2d\u7684\u5b57\u5178\u5b57\u9762\u91cf\uff08dictionary literal\uff09\u4e2d\uff0c\u7f3a\u5c11\u5fc5\u8981\u7684\u5192\u865f\uff08:\uff09\u3002\u5b57\u5178\u5b57\u9762\u91cf\u662f\u7528\u4f86\u5b58\u5132\u9375\u503c\u5c0d\uff08key-value pairs\uff09\u7684\u8cc7\u6599\u7d50\u69cb\uff0c\u800c\u5192\u865f\u5728\u6b64\u8a9e\u6cd5\u4e2d\u626e\u6f14\u8457\u95dc\u9375\u89d2\u8272\u3002<\/p>\n<h2>\u70ba\u4f55\u6703\u51fa\u73fe\u300cExpected &#8216;:&#8217; in Dictionary Literal\u300d\u932f\u8aa4\uff1f<\/h2>\n<p>\u5728 Swift \u4e2d\uff0c\u5b57\u5178\u5b57\u9762\u91cf\u7684\u57fa\u672c\u8a9e\u6cd5\u70ba\u300c\u9375\uff1a\u503c\u300d\uff0c\u5373\u6bcf\u4e00\u5c0d\u9375\u503c\u4e4b\u9593\u5fc5\u9808\u4ee5\u5192\u865f\u5206\u9694\u3002\u5982\u679c\u5728\u5b9a\u7fa9\u5b57\u5178\u6642\u907a\u6f0f\u4e86\u9019\u500b\u5192\u865f\uff0c\u4fbf\u6703\u5c0e\u81f4\u8a72\u932f\u8aa4\u7684\u51fa\u73fe\u3002\u4f8b\u5982\uff0c\u4ee5\u4e0b\u7684\u7a0b\u5f0f\u78bc\u5c31\u6703\u5f15\u767c\u6b64\u932f\u8aa4\uff1a<\/p>\n<pre class=\"brush: python\">\nlet dict = [\"key1\" \"value1\" \"key2\" \"value2\"]\n<\/pre>\n<p>\u5728\u9019\u6bb5\u7a0b\u5f0f\u78bc\u4e2d\uff0c\u5169\u500b\u9375\u503c\u4e4b\u9593\u7f3a\u5c11\u4e86\u5192\u865f\uff0c\u9019\u5c31\u662f\u932f\u8aa4\u7684\u6839\u672c\u539f\u56e0\u3002<\/p>\n<h2>\u5982\u4f55\u6709\u6548\u89e3\u6c7a\u300cExpected &#8216;:&#8217; in Dictionary Literal\u300d\u932f\u8aa4\uff1f<\/h2>\n<p>\u4fee\u5fa9\u9019\u500b\u932f\u8aa4\u975e\u5e38\u7c21\u55ae\uff0c\u53ea\u9700\u5728\u5b57\u5178\u5b57\u9762\u91cf\u4e2d\u6b63\u78ba\u52a0\u5165\u5192\u865f\u5373\u53ef\u3002\u5c07\u4e0a\u8ff0\u932f\u8aa4\u7684\u7a0b\u5f0f\u78bc\u4fee\u6b63\u70ba\uff1a<\/p>\n<pre class=\"brush: python\">\nlet dict = [\"key1\": \"value1\", \"key2\": \"value2\"]\n<\/pre>\n<p>\u9019\u6a23\u5c31\u80fd\u5920\u6b63\u78ba\u5b9a\u7fa9\u5b57\u5178\uff0c\u907f\u514d\u932f\u8aa4\u7684\u518d\u6b21\u767c\u751f\u3002<\/p>\n<h2>\u7e3d\u7d50<\/h2>\n<p>\u300cExpected &#8216;:&#8217; in dictionary literal\u300d\u932f\u8aa4\u662f Swift \u958b\u767c\u4e2d\u7684\u5e38\u898b\u554f\u984c\uff0c\u901a\u5e38\u662f\u7531\u65bc\u8a9e\u6cd5\u4e0d\u6b63\u78ba\u9020\u6210\u7684\u3002\u53ea\u9700\u5728\u5b57\u5178\u5b57\u9762\u91cf\u4e2d\u6b63\u78ba\u52a0\u5165\u5192\u865f\uff0c\u5373\u53ef\u8f15\u9b06\u89e3\u6c7a\u6b64\u554f\u984c\u3002\u5e0c\u671b\u9019\u7bc7\u6587\u7ae0\u80fd\u70ba\u60a8\u5728 Swift \u958b\u767c\u4e4b\u8def\u4e0a\u63d0\u4f9b\u5e6b\u52a9\uff0c\u8b93\u60a8\u66f4\u52a0\u9806\u5229\u5730\u9032\u884c\u7a0b\u5f0f\u8a2d\u8a08\u3002<\/p>\n<p><!--more--><br \/>\n&#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-4151","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-14X","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/4151","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=4151"}],"version-history":[{"count":1,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/4151\/revisions"}],"predecessor-version":[{"id":4152,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/4151\/revisions\/4152"}],"wp:attachment":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/media?parent=4151"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/categories?post=4151"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/tags?post=4151"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}