{"id":547,"date":"2018-02-23T23:39:12","date_gmt":"2018-02-23T15:39:12","guid":{"rendered":"http:\/\/60.205.208.74\/2018\/02\/23\/swift-%e6%89%a9%e5%b1%95\/"},"modified":"2018-02-23T23:39:12","modified_gmt":"2018-02-23T15:39:12","slug":"swift-%e6%89%a9%e5%b1%95","status":"publish","type":"post","link":"https:\/\/www.puzi7.net\/?p=547","title":{"rendered":"Swift \u6269\u5c55"},"content":{"rendered":"<span itemprop=\"description\"><div class=\"article-body\">\n<div class=\"article-intro\" id=\"content\">\n<h1>Swift \u6269\u5c55<\/h1>\n<p>\u6269\u5c55\u5c31\u662f\u5411\u4e00\u4e2a\u5df2\u6709\u7684\u7c7b\u3001\u7ed3\u6784\u4f53\u6216\u679a\u4e3e\u7c7b\u578b\u6dfb\u52a0\u65b0\u529f\u80fd\u3002<\/p>\n<p>\u6269\u5c55\u53ef\u4ee5\u5bf9\u4e00\u4e2a\u7c7b\u578b\u6dfb\u52a0\u65b0\u7684\u529f\u80fd\uff0c\u4f46\u662f\u4e0d\u80fd\u91cd\u5199\u5df2\u6709\u7684\u529f\u80fd\u3002<\/p>\n<p>Swift \u4e2d\u7684\u6269\u5c55\u53ef\u4ee5\uff1a<\/p>\n<ul>\n<li>\u6dfb\u52a0\u8ba1\u7b97\u578b\u5c5e\u6027\u548c\u8ba1\u7b97\u578b\u9759\u6001\u5c5e\u6027<\/li>\n<li>\u5b9a\u4e49\u5b9e\u4f8b\u65b9\u6cd5\u548c\u7c7b\u578b\u65b9\u6cd5<\/li>\n<li>\u63d0\u4f9b\u65b0\u7684\u6784\u9020\u5668<\/li>\n<li>\u5b9a\u4e49\u4e0b\u6807<\/li>\n<li>\u5b9a\u4e49\u548c\u4f7f\u7528\u65b0\u7684\u5d4c\u5957\u7c7b\u578b<\/li>\n<li>\u4f7f\u4e00\u4e2a\u5df2\u6709\u7c7b\u578b\u7b26\u5408\u67d0\u4e2a\u534f\u8bae<\/li>\n<\/ul>\n<h3>\u8bed\u6cd5<\/h3>\n<p>\u6269\u5c55\u58f0\u660e\u4f7f\u7528\u5173\u952e\u5b57 <b>extension<\/b>\uff1a<\/p>\n<pre>\nextension SomeType {\n    \/\/ \u52a0\u5230SomeType\u7684\u65b0\u529f\u80fd\u5199\u5230\u8fd9\u91cc\n}\n<\/pre>\n<p>\u4e00\u4e2a\u6269\u5c55\u53ef\u4ee5\u6269\u5c55\u4e00\u4e2a\u5df2\u6709\u7c7b\u578b\uff0c\u4f7f\u5176\u80fd\u591f\u9002\u914d\u4e00\u4e2a\u6216\u591a\u4e2a\u534f\u8bae\uff0c\u8bed\u6cd5\u683c\u5f0f\u5982\u4e0b\uff1a<\/p>\n<pre>\nextension SomeType: SomeProtocol, AnotherProctocol {\n    \/\/ \u534f\u8bae\u5b9e\u73b0\u5199\u5230\u8fd9\u91cc\n}\n<\/pre>\n<hr>\n<h2>\u8ba1\u7b97\u578b\u5c5e\u6027<\/h2>\n<p>\u6269\u5c55\u53ef\u4ee5\u5411\u5df2\u6709\u7c7b\u578b\u6dfb\u52a0\u8ba1\u7b97\u578b\u5b9e\u4f8b\u5c5e\u6027\u548c\u8ba1\u7b97\u578b\u7c7b\u578b\u5c5e\u6027\u3002<\/p>\n<h3>\u5b9e\u4f8b<\/h3>\n<p>\u4e0b\u9762\u7684\u4f8b\u5b50\u5411 Int \u7c7b\u578b\u6dfb\u52a0\u4e86 5 \u4e2a\u8ba1\u7b97\u578b\u5b9e\u4f8b\u5c5e\u6027\u5e76\u6269\u5c55\u5176\u529f\u80fd\uff1a<\/p>\n<pre>\nextension Int {\n   var add: Int {return self + 100 }\n   var sub: Int { return self - 10 }\n   var mul: Int { return self * 10 }\n   var div: Int { return self \/ 5 }\n}\n    \nlet addition = 3.add\nprint(\"\u52a0\u6cd5\u8fd0\u7b97\u540e\u7684\u503c\uff1a\\(addition)\")\n    \nlet subtraction = 120.sub\nprint(\"\u51cf\u6cd5\u8fd0\u7b97\u540e\u7684\u503c\uff1a\\(subtraction)\")\n    \nlet multiplication = 39.mul\nprint(\"\u4e58\u6cd5\u8fd0\u7b97\u540e\u7684\u503c\uff1a\\(multiplication)\")\n    \nlet division = 55.div\nprint(\"\u9664\u6cd5\u8fd0\u7b97\u540e\u7684\u503c: \\(division)\")\n\nlet mix = 30.add + 34.sub\nprint(\"\u6df7\u5408\u8fd0\u7b97\u7ed3\u679c\uff1a\\(mix)\")\n<\/pre>\n<p>\u4ee5\u4e0a\u7a0b\u5e8f\u6267\u884c\u8f93\u51fa\u7ed3\u679c\u4e3a\uff1a<\/p>\n<pre>\n\u52a0\u6cd5\u8fd0\u7b97\u540e\u7684\u503c\uff1a103\n\u51cf\u6cd5\u8fd0\u7b97\u540e\u7684\u503c\uff1a110\n\u4e58\u6cd5\u8fd0\u7b97\u540e\u7684\u503c\uff1a390\n\u9664\u6cd5\u8fd0\u7b97\u540e\u7684\u503c: 11\n\u6df7\u5408\u8fd0\u7b97\u7ed3\u679c\uff1a154\n<\/pre>\n<hr>\n<h2>\u6784\u9020\u5668<\/h2>\n<p>\u6269\u5c55\u53ef\u4ee5\u5411\u5df2\u6709\u7c7b\u578b\u6dfb\u52a0\u65b0\u7684\u6784\u9020\u5668\u3002<\/p>\n<p>\u8fd9\u53ef\u4ee5\u8ba9\u4f60\u6269\u5c55\u5176\u5b83\u7c7b\u578b\uff0c\u5c06\u4f60\u81ea\u5df1\u7684\u5b9a\u5236\u7c7b\u578b\u4f5c\u4e3a\u6784\u9020\u5668\u53c2\u6570\uff0c\u6216\u8005\u63d0\u4f9b\u8be5\u7c7b\u578b\u7684\u539f\u59cb\u5b9e\u73b0\u4e2d\u6ca1\u6709\u5305\u542b\u7684\u989d\u5916\u521d\u59cb\u5316\u9009\u9879\u3002<\/p>\n<p>\u6269\u5c55\u53ef\u4ee5\u5411\u7c7b\u4e2d\u6dfb\u52a0\u65b0\u7684\u4fbf\u5229\u6784\u9020\u5668  init()\uff0c\u4f46\u662f\u5b83\u4eec\u4e0d\u80fd\u5411\u7c7b\u4e2d\u6dfb\u52a0\u65b0\u7684\u6307\u5b9a\u6784\u9020\u5668\u6216\u6790\u6784\u51fd\u6570 deinit() \u3002<\/p>\n<pre>\nstruct sum {\n    var num1 = 100, num2 = 200\n}\n\nstruct diff {\n    var no1 = 200, no2 = 100\n}\n\nstruct mult {\n    var a = sum()\n    var b = diff()\n}\n\n\nextension mult {\n    init(x: sum, y: diff) {\n        _ = x.num1 + x.num2\n        _ = y.no1 + y.no2\n    }\n}\n\n\nlet a = sum(num1: 100, num2: 200)\nlet b = diff(no1: 200, no2: 100)\n\nlet getMult = mult(x: a, y: b)\nprint(\"getMult sum\\(getMult.a.num1, getMult.a.num2)\")\nprint(\"getMult diff\\(getMult.b.no1, getMult.b.no2)\")\n<\/pre>\n<p>\u4ee5\u4e0a\u7a0b\u5e8f\u6267\u884c\u8f93\u51fa\u7ed3\u679c\u4e3a\uff1a<\/p>\n<pre>\ngetMult sum(100, 200)\ngetMult diff(200, 100)\n<\/pre>\n<hr>\n<h2>\u65b9\u6cd5<\/h2>\n<p>\u6269\u5c55\u53ef\u4ee5\u5411\u5df2\u6709\u7c7b\u578b\u6dfb\u52a0\u65b0\u7684\u5b9e\u4f8b\u65b9\u6cd5\u548c\u7c7b\u578b\u65b9\u6cd5\u3002<\/p>\n<p>\u4e0b\u9762\u7684\u4f8b\u5b50\u5411Int\u7c7b\u578b\u6dfb\u52a0\u4e00\u4e2a\u540d\u4e3a topics \u7684\u65b0\u5b9e\u4f8b\u65b9\u6cd5\uff1a<\/p>\n<pre>\nextension Int {\n   func topics(summation: () -&gt; ()) {\n      for _ in 0..&lt;self {\n         summation() \n      }\n   }\n}  \n\n4.topics({\n   print(\"\u6269\u5c55\u6a21\u5757\u5185\")       \n})    \n    \n3.topics({\n   print(\"\u5185\u578b\u8f6c\u6362\u6a21\u5757\u5185\")       \n})  \n<\/pre>\n<p>\u4ee5\u4e0a\u7a0b\u5e8f\u6267\u884c\u8f93\u51fa\u7ed3\u679c\u4e3a\uff1a<\/p>\n<pre>\n\u6269\u5c55\u6a21\u5757\u5185\n\u6269\u5c55\u6a21\u5757\u5185\n\u6269\u5c55\u6a21\u5757\u5185\n\u6269\u5c55\u6a21\u5757\u5185\n\u5185\u578b\u8f6c\u6362\u6a21\u5757\u5185\n\u5185\u578b\u8f6c\u6362\u6a21\u5757\u5185\n\u5185\u578b\u8f6c\u6362\u6a21\u5757\u5185\n<\/pre>\n<p>\u8fd9\u4e2a<code>topics<\/code>\u65b9\u6cd5\u4f7f\u7528\u4e86\u4e00\u4e2a<code>() -&gt; ()<\/code>\u7c7b\u578b\u7684\u5355\u53c2\u6570\uff0c\u8868\u660e\u51fd\u6570\u6ca1\u6709\u53c2\u6570\u800c\u4e14\u6ca1\u6709\u8fd4\u56de\u503c\u3002<\/p>\n<p>\u5b9a\u4e49\u8be5\u6269\u5c55\u4e4b\u540e\uff0c\u4f60\u5c31\u53ef\u4ee5\u5bf9\u4efb\u610f\u6574\u6570\u8c03\u7528 <code>topics<\/code> \u65b9\u6cd5,\u5b9e\u73b0\u7684\u529f\u80fd\u5219\u662f\u591a\u6b21\u6267\u884c\u67d0\u4efb\u52a1\uff1a<\/p>\n<hr>\n<h2>\u53ef\u53d8\u5b9e\u4f8b\u65b9\u6cd5<\/h2>\n<p>\u901a\u8fc7\u6269\u5c55\u6dfb\u52a0\u7684\u5b9e\u4f8b\u65b9\u6cd5\u4e5f\u53ef\u4ee5\u4fee\u6539\u8be5\u5b9e\u4f8b\u672c\u8eab\u3002<\/p>\n<p>\u7ed3\u6784\u4f53\u548c\u679a\u4e3e\u7c7b\u578b\u4e2d\u4fee\u6539self\u6216\u5176\u5c5e\u6027\u7684\u65b9\u6cd5\u5fc5\u987b\u5c06\u8be5\u5b9e\u4f8b\u65b9\u6cd5\u6807\u6ce8\u4e3amutating\uff0c\u6b63\u5982\u6765\u81ea\u539f\u59cb\u5b9e\u73b0\u7684\u4fee\u6539\u65b9\u6cd5\u4e00\u6837\u3002<\/p>\n<h3>\u5b9e\u4f8b<\/h3>\n<p>\u4e0b\u9762\u7684\u4f8b\u5b50\u5411 Swift \u7684 Double \u7c7b\u578b\u6dfb\u52a0\u4e86\u4e00\u4e2a\u65b0\u7684\u540d\u4e3a square \u7684\u4fee\u6539\u65b9\u6cd5\uff0c\u6765\u5b9e\u73b0\u4e00\u4e2a\u539f\u59cb\u503c\u7684\u5e73\u65b9\u8ba1\u7b97\uff1a<\/p>\n<pre>\nextension Double {\n   mutating func square() {\n      let pi = 3.1415\n      self = pi * self * self\n   }\n}\n\nvar Trial1 = 3.3\nTrial1.square()\nprint(\"\u5706\u7684\u9762\u79ef\u4e3a: \\(Trial1)\")\n\n\nvar Trial2 = 5.8\nTrial2.square()\nprint(\"\u5706\u7684\u9762\u79ef\u4e3a: \\(Trial2)\")\n\n\nvar Trial3 = 120.3\nTrial3.square()\nprint(\"\u5706\u7684\u9762\u79ef\u4e3a: \\(Trial3)\")\n<\/pre>\n<p>\u4ee5\u4e0a\u7a0b\u5e8f\u6267\u884c\u8f93\u51fa\u7ed3\u679c\u4e3a\uff1a<\/p>\n<pre>\n\u5706\u7684\u9762\u79ef\u4e3a: 34.210935\n\u5706\u7684\u9762\u79ef\u4e3a: 105.68006\n\u5706\u7684\u9762\u79ef\u4e3a: 45464.070735\n<\/pre>\n<hr>\n<h2>\u4e0b\u6807<\/h2>\n<p>\u6269\u5c55\u53ef\u4ee5\u5411\u4e00\u4e2a\u5df2\u6709\u7c7b\u578b\u6dfb\u52a0\u65b0\u4e0b\u6807\u3002<\/p>\n<h3>\u5b9e\u4f8b<\/h3>\n<p>\u4ee5\u4e0b\u4f8b\u5b50\u5411 Swift \u5185\u5efa\u7c7b\u578bInt\u6dfb\u52a0\u4e86\u4e00\u4e2a\u6574\u578b\u4e0b\u6807\u3002\u8be5\u4e0b\u6807[n]\u8fd4\u56de\u5341\u8fdb\u5236\u6570\u5b57<\/p>\n<pre>\nextension Int {\n   subscript(var multtable: Int) -&gt; Int {\n      var no1 = 1\n      while multtable &gt; 0 {\n         no1 *= 10\n         --multtable\n      }\n      return (self \/ no1) % 10\n   }\n}\n    \nprint(12[0])\nprint(7869[1])\nprint(786543[2])\n<\/pre>\n<p>\u4ee5\u4e0a\u7a0b\u5e8f\u6267\u884c\u8f93\u51fa\u7ed3\u679c\u4e3a\uff1a<\/p>\n<pre>\n2\n6\n5\n<\/pre>\n<hr>\n<h2>\u5d4c\u5957\u7c7b\u578b<\/h2>\n<p>\u6269\u5c55\u53ef\u4ee5\u5411\u5df2\u6709\u7684\u7c7b\u3001\u7ed3\u6784\u4f53\u548c\u679a\u4e3e\u6dfb\u52a0\u65b0\u7684\u5d4c\u5957\u7c7b\u578b\uff1a<\/p>\n<pre>\nextension Int {\n   enum calc\n   {\n      case add\n      case sub\n      case mult\n      case div\n      case anything\n   }\n\n   var print: calc {\n      switch self\n      {\n         case 0:\n            return .add\n         case 1:\n            return .sub\n         case 2:\n            return .mult\n         case 3:\n            return .div\n         default:\n            return .anything\n       }\n   }\n}\n\nfunc result(numb: [Int]) {\n   for i in numb {\n      switch i.print {\n         case .add:\n            print(\" 10 \")\n          case .sub:\n            print(\" 20 \")\n         case .mult:\n         print(\" 30 \")\n         case .div:\n         print(\" 40 \")\n         default:\n         print(\" 50 \")\n\n      }\n   }\n}\n\nresult([0, 1, 2, 3, 4, 7])\n<\/pre>\n<p>\u4ee5\u4e0a\u7a0b\u5e8f\u6267\u884c\u8f93\u51fa\u7ed3\u679c\u4e3a\uff1a<\/p>\n<pre>\n 10 \n 20 \n 30 \n 40 \n 50 \n 50 \n<\/pre>\n<\/p><\/div>\n<\/p><\/div>\n<span>","protected":false},"excerpt":{"rendered":"<p class=\"excerpt\"><span itemprop=\"description\">Swift \u6269\u5c55 \u6269\u5c55\u5c31\u662f\u5411\u4e00\u4e2a\u5df2\u6709\u7684\u7c7b\u3001\u7ed3\u6784\u4f53\u6216\u679a\u4e3e\u7c7b\u578b\u6dfb\u52a0\u65b0\u529f\u80fd\u3002 \u6269\u5c55\u53ef\u4ee5\u5bf9\u4e00\u4e2a\u7c7b\u578b&hellip;<\/span><\/p>\n<p class=\"more-link-p btn-align-right\"><a class=\"green zoom-btn\" href=\"https:\/\/www.puzi7.net\/?p=547\">Read More<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26,28],"tags":[74,119],"class_list":["post-547","post","type-post","status-publish","format-standard","hentry","category-mobile","category-swift","tag-ios","tag-swift","zoom-theme-has-thumb"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Swift \u6269\u5c55 - \u8c31\u5b50\u68cb - Puzi7<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.puzi7.net\/?p=547\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Swift \u6269\u5c55 - \u8c31\u5b50\u68cb - Puzi7\" \/>\n<meta property=\"og:description\" content=\"Swift \u6269\u5c55 \u6269\u5c55\u5c31\u662f\u5411\u4e00\u4e2a\u5df2\u6709\u7684\u7c7b\u3001\u7ed3\u6784\u4f53\u6216\u679a\u4e3e\u7c7b\u578b\u6dfb\u52a0\u65b0\u529f\u80fd\u3002 \u6269\u5c55\u53ef\u4ee5\u5bf9\u4e00\u4e2a\u7c7b\u578b&hellip;Read More\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.puzi7.net\/?p=547\" \/>\n<meta property=\"og:site_name\" content=\"\u8c31\u5b50\u68cb - Puzi7\" \/>\n<meta property=\"article:published_time\" content=\"2018-02-23T15:39:12+00:00\" \/>\n<meta name=\"author\" content=\"\u77f3\u8863\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u77f3\u8863\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.puzi7.net\\\/?p=547#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.puzi7.net\\\/?p=547\"},\"author\":{\"name\":\"\u77f3\u8863\",\"@id\":\"https:\\\/\\\/www.puzi7.net\\\/#\\\/schema\\\/person\\\/87dd4941c8ec260c1350b7f41980a190\"},\"headline\":\"Swift \u6269\u5c55\",\"datePublished\":\"2018-02-23T15:39:12+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.puzi7.net\\\/?p=547\"},\"wordCount\":17,\"commentCount\":0,\"keywords\":[\"iOS\",\"Swift\"],\"articleSection\":[\"Mobile\",\"Swift\"],\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.puzi7.net\\\/?p=547#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.puzi7.net\\\/?p=547\",\"url\":\"https:\\\/\\\/www.puzi7.net\\\/?p=547\",\"name\":\"Swift \u6269\u5c55 - \u8c31\u5b50\u68cb - Puzi7\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.puzi7.net\\\/#website\"},\"datePublished\":\"2018-02-23T15:39:12+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.puzi7.net\\\/#\\\/schema\\\/person\\\/87dd4941c8ec260c1350b7f41980a190\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.puzi7.net\\\/?p=547#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.puzi7.net\\\/?p=547\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.puzi7.net\\\/?p=547#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\\\/\\\/www.puzi7.net\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u6280\u672f\",\"item\":\"https:\\\/\\\/www.puzi7.net\\\/?cat=9\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Mobile\",\"item\":\"https:\\\/\\\/www.puzi7.net\\\/?cat=26\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Swift\",\"item\":\"https:\\\/\\\/www.puzi7.net\\\/?cat=28\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"Swift \u6269\u5c55\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.puzi7.net\\\/#website\",\"url\":\"https:\\\/\\\/www.puzi7.net\\\/\",\"name\":\"\u8c31\u5b50\u68cb - Puzi7\",\"description\":\"\u5206\u4eab\uff0c\u6210\u957f\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.puzi7.net\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.puzi7.net\\\/#\\\/schema\\\/person\\\/87dd4941c8ec260c1350b7f41980a190\",\"name\":\"\u77f3\u8863\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/c52c3a64b447af78e58cfa1c73ddd53952049afcf934cd702d71eee91f9907bd?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/c52c3a64b447af78e58cfa1c73ddd53952049afcf934cd702d71eee91f9907bd?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/c52c3a64b447af78e58cfa1c73ddd53952049afcf934cd702d71eee91f9907bd?s=96&d=mm&r=g\",\"caption\":\"\u77f3\u8863\"},\"sameAs\":[\"https:\\\/\\\/www.puzi7.net\"],\"url\":\"https:\\\/\\\/www.puzi7.net\\\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Swift \u6269\u5c55 - \u8c31\u5b50\u68cb - Puzi7","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.puzi7.net\/?p=547","og_locale":"zh_CN","og_type":"article","og_title":"Swift \u6269\u5c55 - \u8c31\u5b50\u68cb - Puzi7","og_description":"Swift \u6269\u5c55 \u6269\u5c55\u5c31\u662f\u5411\u4e00\u4e2a\u5df2\u6709\u7684\u7c7b\u3001\u7ed3\u6784\u4f53\u6216\u679a\u4e3e\u7c7b\u578b\u6dfb\u52a0\u65b0\u529f\u80fd\u3002 \u6269\u5c55\u53ef\u4ee5\u5bf9\u4e00\u4e2a\u7c7b\u578b&hellip;Read More","og_url":"https:\/\/www.puzi7.net\/?p=547","og_site_name":"\u8c31\u5b50\u68cb - Puzi7","article_published_time":"2018-02-23T15:39:12+00:00","author":"\u77f3\u8863","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u77f3\u8863","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"1 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.puzi7.net\/?p=547#article","isPartOf":{"@id":"https:\/\/www.puzi7.net\/?p=547"},"author":{"name":"\u77f3\u8863","@id":"https:\/\/www.puzi7.net\/#\/schema\/person\/87dd4941c8ec260c1350b7f41980a190"},"headline":"Swift \u6269\u5c55","datePublished":"2018-02-23T15:39:12+00:00","mainEntityOfPage":{"@id":"https:\/\/www.puzi7.net\/?p=547"},"wordCount":17,"commentCount":0,"keywords":["iOS","Swift"],"articleSection":["Mobile","Swift"],"inLanguage":"zh-Hans","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.puzi7.net\/?p=547#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.puzi7.net\/?p=547","url":"https:\/\/www.puzi7.net\/?p=547","name":"Swift \u6269\u5c55 - \u8c31\u5b50\u68cb - Puzi7","isPartOf":{"@id":"https:\/\/www.puzi7.net\/#website"},"datePublished":"2018-02-23T15:39:12+00:00","author":{"@id":"https:\/\/www.puzi7.net\/#\/schema\/person\/87dd4941c8ec260c1350b7f41980a190"},"breadcrumb":{"@id":"https:\/\/www.puzi7.net\/?p=547#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.puzi7.net\/?p=547"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.puzi7.net\/?p=547#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.puzi7.net\/"},{"@type":"ListItem","position":2,"name":"\u6280\u672f","item":"https:\/\/www.puzi7.net\/?cat=9"},{"@type":"ListItem","position":3,"name":"Mobile","item":"https:\/\/www.puzi7.net\/?cat=26"},{"@type":"ListItem","position":4,"name":"Swift","item":"https:\/\/www.puzi7.net\/?cat=28"},{"@type":"ListItem","position":5,"name":"Swift \u6269\u5c55"}]},{"@type":"WebSite","@id":"https:\/\/www.puzi7.net\/#website","url":"https:\/\/www.puzi7.net\/","name":"\u8c31\u5b50\u68cb - Puzi7","description":"\u5206\u4eab\uff0c\u6210\u957f","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.puzi7.net\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.puzi7.net\/#\/schema\/person\/87dd4941c8ec260c1350b7f41980a190","name":"\u77f3\u8863","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/secure.gravatar.com\/avatar\/c52c3a64b447af78e58cfa1c73ddd53952049afcf934cd702d71eee91f9907bd?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/c52c3a64b447af78e58cfa1c73ddd53952049afcf934cd702d71eee91f9907bd?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c52c3a64b447af78e58cfa1c73ddd53952049afcf934cd702d71eee91f9907bd?s=96&d=mm&r=g","caption":"\u77f3\u8863"},"sameAs":["https:\/\/www.puzi7.net"],"url":"https:\/\/www.puzi7.net\/?author=1"}]}},"_links":{"self":[{"href":"https:\/\/www.puzi7.net\/index.php?rest_route=\/wp\/v2\/posts\/547","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.puzi7.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.puzi7.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.puzi7.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.puzi7.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=547"}],"version-history":[{"count":0,"href":"https:\/\/www.puzi7.net\/index.php?rest_route=\/wp\/v2\/posts\/547\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.puzi7.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=547"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.puzi7.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=547"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.puzi7.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=547"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}