{"id":539,"date":"2018-02-23T23:39:06","date_gmt":"2018-02-23T15:39:06","guid":{"rendered":"http:\/\/60.205.208.74\/2018\/02\/23\/swift-%e6%96%b9%e6%b3%95\/"},"modified":"2018-02-23T23:39:06","modified_gmt":"2018-02-23T15:39:06","slug":"swift-%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/www.puzi7.net\/?p=539","title":{"rendered":"Swift \u65b9\u6cd5"},"content":{"rendered":"<span itemprop=\"description\"><div class=\"article-body\">\n<div class=\"article-intro\" id=\"content\">\n<h1>Swift \u65b9\u6cd5<\/h1>\n<p>Swift \u65b9\u6cd5\u662f\u4e0e\u67d0\u4e9b\u7279\u5b9a\u7c7b\u578b\u76f8\u5173\u8054\u7684\u51fd\u6570<\/p>\n<p>\u5728 Objective-C \u4e2d\uff0c\u7c7b\u662f\u552f\u4e00\u80fd\u5b9a\u4e49\u65b9\u6cd5\u7684\u7c7b\u578b\u3002\u4f46\u5728 Swift \u4e2d\uff0c\u4f60\u4e0d\u4ec5\u80fd\u9009\u62e9\u662f\u5426\u8981\u5b9a\u4e49\u4e00\u4e2a\u7c7b\/\u7ed3\u6784\u4f53\/\u679a\u4e3e\uff0c\u8fd8\u80fd\u7075\u6d3b\u7684\u5728\u4f60\u521b\u5efa\u7684\u7c7b\u578b\uff08\u7c7b\/\u7ed3\u6784\u4f53\/\u679a\u4e3e\uff09\u4e0a\u5b9a\u4e49\u65b9\u6cd5\u3002<\/p>\n<hr>\n<h2>\u5b9e\u4f8b\u65b9\u6cd5<\/h2>\n<p>\u5728 Swift \u8bed\u8a00\u4e2d\uff0c\u5b9e\u4f8b\u65b9\u6cd5\u662f\u5c5e\u4e8e\u67d0\u4e2a\u7279\u5b9a\u7c7b\u3001\u7ed3\u6784\u4f53\u6216\u8005\u679a\u4e3e\u7c7b\u578b\u5b9e\u4f8b\u7684\u65b9\u6cd5\u3002<\/p>\n<p>\u5b9e\u4f8b\u65b9\u6cd5\u63d0\u4f9b\u4ee5\u4e0b\u65b9\u6cd5\uff1a<\/p>\n<ul>\n<li>\n<p>\u53ef\u4ee5\u8bbf\u95ee\u548c\u4fee\u6539\u5b9e\u4f8b\u5c5e\u6027<\/p>\n<\/li>\n<li>\n<p>\u63d0\u4f9b\u4e0e\u5b9e\u4f8b\u76ee\u7684\u76f8\u5173\u7684\u529f\u80fd<\/p>\n<\/li>\n<\/ul>\n<p>\u5b9e\u4f8b\u65b9\u6cd5\u8981\u5199\u5728\u5b83\u6240\u5c5e\u7684\u7c7b\u578b\u7684\u524d\u540e\u5927\u62ec\u53f7({})\u4e4b\u95f4\u3002<\/p>\n<p>\u5b9e\u4f8b\u65b9\u6cd5\u80fd\u591f\u9690\u5f0f\u8bbf\u95ee\u5b83\u6240\u5c5e\u7c7b\u578b\u7684\u6240\u6709\u7684\u5176\u4ed6\u5b9e\u4f8b\u65b9\u6cd5\u548c\u5c5e\u6027\u3002\n<\/p>\n<p>\u5b9e\u4f8b\u65b9\u6cd5\u53ea\u80fd\u88ab\u5b83\u6240\u5c5e\u7684\u7c7b\u7684\u67d0\u4e2a\u7279\u5b9a\u5b9e\u4f8b\u8c03\u7528\u3002<\/p>\n<p>\u5b9e\u4f8b\u65b9\u6cd5\u4e0d\u80fd\u8131\u79bb\u4e8e\u73b0\u5b58\u7684\u5b9e\u4f8b\u800c\u88ab\u8c03\u7528\u3002<\/p>\n<h3>\u8bed\u6cd5<\/h3>\n<pre>\nfunc funcname(Parameters) -&gt; returntype\n{\n    Statement1\n    Statement2\n    \u2026\u2026\n    Statement N\n    return parameters\n}\n<\/pre>\n<h3>\u5b9e\u4f8b<\/h3>\n<pre>\nimport Cocoa\n\nclass Counter {\n    var count = 0\n    func increment() {\n        count += 1\n    }\n    func incrementBy(amount: Int) {\n        count += amount\n    }\n    func reset() {\n        count = 0\n    }\n}\n\/\/ \u521d\u59cb\u8ba1\u6570\u503c\u662f0\nlet counter = Counter()\n\n\/\/ \u8ba1\u6570\u503c\u73b0\u5728\u662f1\ncounter.increment()\n\n\/\/ \u8ba1\u6570\u503c\u73b0\u5728\u662f6\ncounter.incrementBy(amount: 5)\nprint(counter.count)\n\n\/\/ \u8ba1\u6570\u503c\u73b0\u5728\u662f0\ncounter.reset()\nprint(counter.count)\n<\/pre>\n<p>\u4ee5\u4e0a\u7a0b\u5e8f\u6267\u884c\u8f93\u51fa\u7ed3\u679c\u4e3a\uff1a<\/p>\n<pre>\n6\n0\n<\/pre>\n<p>Counter\u7c7b\u5b9a\u4e49\u4e86\u4e09\u4e2a\u5b9e\u4f8b\u65b9\u6cd5\uff1a<\/p>\n<ul>\n<li><b>increment<\/b> \u8ba9\u8ba1\u6570\u5668\u6309 1 \u9012\u589e\uff1b<\/li>\n<li><b>incrementBy(amount: Int)<\/b> \u8ba9\u8ba1\u6570\u5668\u6309\u4e00\u4e2a\u6307\u5b9a\u7684\u6574\u6570\u503c\u9012\u589e\uff1b<\/li>\n<li><b>reset<\/b> \u5c06\u8ba1\u6570\u5668\u91cd\u7f6e\u4e3a0\u3002<\/li>\n<\/ul>\n<p><b>Counter<\/b> \u8fd9\u4e2a\u7c7b\u8fd8\u58f0\u660e\u4e86\u4e00\u4e2a\u53ef\u53d8\u5c5e\u6027 <b>count<\/b>\uff0c\u7528\u5b83\u6765\u4fdd\u6301\u5bf9\u5f53\u524d\u8ba1\u6570\u5668\u503c\u7684\u8ffd\u8e2a\u3002<\/p>\n<hr>\n<h2>\u65b9\u6cd5\u7684\u5c40\u90e8\u53c2\u6570\u540d\u79f0\u548c\u5916\u90e8\u53c2\u6570\u540d\u79f0<\/h2>\n<p>Swift \u51fd\u6570\u53c2\u6570\u53ef\u4ee5\u540c\u65f6\u6709\u4e00\u4e2a\u5c40\u90e8\u540d\u79f0\uff08\u5728\u51fd\u6570\u4f53\u5185\u90e8\u4f7f\u7528\uff09\u548c\u4e00\u4e2a\u5916\u90e8\u540d\u79f0\uff08\u5728\u8c03\u7528\u51fd\u6570\u65f6\u4f7f\u7528<\/p>\n<p>Swift \u4e2d\u7684\u65b9\u6cd5\u548c Objective-C \u4e2d\u7684\u65b9\u6cd5\u6781\u5176\u76f8\u4f3c\u3002\u50cf\u5728 Objective-C \u4e2d\u4e00\u6837\uff0cSwift \u4e2d\u65b9\u6cd5\u7684\u540d\u79f0\u901a\u5e38\u7528\u4e00\u4e2a\u4ecb\u8bcd\u6307\u5411\u65b9\u6cd5\u7684\u7b2c\u4e00\u4e2a\u53c2\u6570\uff0c\u6bd4\u5982\uff1awith\uff0cfor\uff0cby\u7b49\u7b49\u3002<\/p>\n<p>Swift \u9ed8\u8ba4\u4ec5\u7ed9\u65b9\u6cd5\u7684\u7b2c\u4e00\u4e2a\u53c2\u6570\u540d\u79f0\u4e00\u4e2a\u5c40\u90e8\u53c2\u6570\u540d\u79f0;\u9ed8\u8ba4\u540c\u65f6\u7ed9\u7b2c\u4e8c\u4e2a\u548c\u540e\u7eed\u7684\u53c2\u6570\u540d\u79f0\u4e3a\u5168\u5c40\u53c2\u6570\u540d\u79f0\u3002<\/p>\n<p>\n\u4ee5\u4e0b\u5b9e\u4f8b\u4e2d &#8216;no1&#8242; \u5728swift\u4e2d\u58f0\u660e\u4e3a\u5c40\u90e8\u53c2\u6570\u540d\u79f0\u3002&#8217;no2&#8217; \u7528\u4e8e\u5168\u5c40\u7684\u58f0\u660e\u5e76\u901a\u8fc7\u5916\u90e8\u7a0b\u5e8f\u8bbf\u95ee\u3002<\/p>\n<pre>\nimport Cocoa\n\nclass division {\n    var count: Int = 0\n    func incrementBy(no1: Int, no2: Int) {\n        count = no1 \/ no2\n        print(count)\n    }\n}\n\nlet counter = division()\ncounter.incrementBy(no1: 1800, no2: 3)\ncounter.incrementBy(no1: 1600, no2: 5)\ncounter.incrementBy(no1: 11000, no2: 3)\n<\/pre>\n<p>\u4ee5\u4e0a\u7a0b\u5e8f\u6267\u884c\u8f93\u51fa\u7ed3\u679c\u4e3a\uff1a<\/p>\n<pre>\n600\n320\n3666\n<\/pre>\n<h3>\u662f\u5426\u63d0\u4f9b\u5916\u90e8\u540d\u79f0\u8bbe\u7f6e<\/h3>\n<p>\u6211\u4eec\u5f3a\u5236\u5728\u7b2c\u4e00\u4e2a\u53c2\u6570\u6dfb\u52a0\u5916\u90e8\u540d\u79f0\u628a\u8fd9\u4e2a\u5c40\u90e8\u540d\u79f0\u5f53\u4f5c\u5916\u90e8\u540d\u79f0\u4f7f\u7528\uff08Swift 2.0\u524d\u662f\u4f7f\u7528 # \u53f7\uff09\u3002\n<\/p>\n<p>\u76f8\u53cd\uff0c\u6211\u4eec\u5462\u4e5f\u53ef\u4ee5\u4f7f\u7528\u4e0b\u5212\u7ebf\uff08_\uff09\u8bbe\u7f6e\u7b2c\u4e8c\u4e2a\u53ca\u540e\u7eed\u7684\u53c2\u6570\u4e0d\u63d0\u4f9b\u4e00\u4e2a\u5916\u90e8\u540d\u79f0\u3002<\/p>\n<pre>\nimport Cocoa\n\nclass multiplication {\n    var count: Int = 0\n    func incrementBy(first no1: Int, no2: Int) {\n        count = no1 * no2\n        print(count)\n    }\n}\n\nlet counter = multiplication()\ncounter.incrementBy(first: 800, no2: 3)\ncounter.incrementBy(first: 100, no2: 5)\ncounter.incrementBy(first: 15000, no2: 3)\n<\/pre>\n<p>\u4ee5\u4e0a\u7a0b\u5e8f\u6267\u884c\u8f93\u51fa\u7ed3\u679c\u4e3a\uff1a<\/p>\n<pre>\n2400\n500\n45000\n<\/pre>\n<hr>\n<h2>self \u5c5e\u6027<\/h2>\n<p>\u7c7b\u578b\u7684\u6bcf\u4e00\u4e2a\u5b9e\u4f8b\u90fd\u6709\u4e00\u4e2a\u9690\u542b\u5c5e\u6027\u53eb\u505aself\uff0cself \u5b8c\u5168\u7b49\u540c\u4e8e\u8be5\u5b9e\u4f8b\u672c\u8eab\u3002<\/p>\n<p>\u4f60\u53ef\u4ee5\u5728\u4e00\u4e2a\u5b9e\u4f8b\u7684\u5b9e\u4f8b\u65b9\u6cd5\u4e2d\u4f7f\u7528\u8fd9\u4e2a\u9690\u542b\u7684self\u5c5e\u6027\u6765\u5f15\u7528\u5f53\u524d\u5b9e\u4f8b\u3002<\/p>\n<pre>\nimport Cocoa\n\nclass calculations {\n    let a: Int\n    let b: Int\n    let res: Int\n    \n    init(a: Int, b: Int) {\n        self.a = a\n        self.b = b\n        res = a + b\n        print(\"Self \u5185: \\(res)\")\n    }\n    \n    func tot(c: Int) -&gt; Int {\n        return res - c\n    }\n    \n    func result() {\n        print(\"\u7ed3\u679c\u4e3a: \\(tot(c: 20))\")\n        print(\"\u7ed3\u679c\u4e3a: \\(tot(c: 50))\")\n    }\n}\n\nlet pri = calculations(a: 600, b: 300)\nlet sum = calculations(a: 1200, b: 300)\n\npri.result()\nsum.result()\n<\/pre>\n<p>\u4ee5\u4e0a\u7a0b\u5e8f\u6267\u884c\u8f93\u51fa\u7ed3\u679c\u4e3a\uff1a<\/p>\n<pre>\nSelf \u5185: 900\nSelf \u5185: 1500\n\u7ed3\u679c\u4e3a: 880\n\u7ed3\u679c\u4e3a: 850\n\u7ed3\u679c\u4e3a: 1480\n\u7ed3\u679c\u4e3a: 1450\n<\/pre>\n<hr>\n<h2>\u5728\u5b9e\u4f8b\u65b9\u6cd5\u4e2d\u4fee\u6539\u503c\u7c7b\u578b<\/h2>\n<p>Swift \u8bed\u8a00\u4e2d\u7ed3\u6784\u4f53\u548c\u679a\u4e3e\u662f\u503c\u7c7b\u578b\u3002\u4e00\u822c\u60c5\u51b5\u4e0b\uff0c\u503c\u7c7b\u578b\u7684\u5c5e\u6027\u4e0d\u80fd\u5728\u5b83\u7684\u5b9e\u4f8b\u65b9\u6cd5\u4e2d\u88ab\u4fee\u6539\u3002<\/p>\n<p>\u4f46\u662f\uff0c\u5982\u679c\u4f60\u786e\u5b9e\u9700\u8981\u5728\u67d0\u4e2a\u5177\u4f53\u7684\u65b9\u6cd5\u4e2d\u4fee\u6539\u7ed3\u6784\u4f53\u6216\u8005\u679a\u4e3e\u7684\u5c5e\u6027\uff0c\u4f60\u53ef\u4ee5\u9009\u62e9\u53d8\u5f02(mutating)\u8fd9\u4e2a\u65b9\u6cd5\uff0c\u7136\u540e\u65b9\u6cd5\u5c31\u53ef\u4ee5\u4ece\u65b9\u6cd5\u5185\u90e8\u6539\u53d8\u5b83\u7684\u5c5e\u6027\uff1b\u5e76\u4e14\u5b83\u505a\u7684\u4efb\u4f55\u6539\u53d8\u5728\u65b9\u6cd5\u7ed3\u675f\u65f6\u8fd8\u4f1a\u4fdd\u7559\u5728\u539f\u59cb\u7ed3\u6784\u4e2d\u3002<\/p>\n<p>\u65b9\u6cd5\u8fd8\u53ef\u4ee5\u7ed9\u5b83\u9690\u542b\u7684self\u5c5e\u6027\u8d4b\u503c\u4e00\u4e2a\u5168\u65b0\u7684\u5b9e\u4f8b\uff0c\u8fd9\u4e2a\u65b0\u5b9e\u4f8b\u5728\u65b9\u6cd5\u7ed3\u675f\u540e\u5c06\u66ff\u6362\u539f\u6765\u7684\u5b9e\u4f8b\u3002\n<\/p>\n<pre>\nimport Cocoa\n\nstruct area {\n    var length = 1\n    var breadth = 1\n    \n    func area() -&gt; Int {\n        return length * breadth\n    }\n    \n    mutating func scaleBy(res: Int) {\n        length *= res\n        breadth *= res\n        \n        print(length)\n        print(breadth)\n    }\n}\n\nvar val = area(length: 3, breadth: 5)\nval.scaleBy(res: 3)\nval.scaleBy(res: 30)\nval.scaleBy(res: 300)\n<\/pre>\n<p>\u4ee5\u4e0a\u7a0b\u5e8f\u6267\u884c\u8f93\u51fa\u7ed3\u679c\u4e3a\uff1a<\/p>\n<pre>\n9\n15\n270\n450\n81000\n135000\n<\/pre>\n<hr>\n<h2>\u5728\u53ef\u53d8\u65b9\u6cd5\u4e2d\u7ed9 self \u8d4b\u503c<\/h2>\n<p>\u53ef\u53d8\u65b9\u6cd5\u80fd\u591f\u8d4b\u7ed9\u9690\u542b\u5c5e\u6027 self \u4e00\u4e2a\u5168\u65b0\u7684\u5b9e\u4f8b\u3002<\/p>\n<pre>\nimport Cocoa\n\nstruct area {\n    var length = 1\n    var breadth = 1\n    \n    func area() -&gt; Int {\n        return length * breadth\n    }\n    \n    mutating func scaleBy(res: Int) {\n        self.length *= res\n        self.breadth *= res\n        print(length)\n        print(breadth)\n    }\n}\nvar val = area(length: 3, breadth: 5)\nval.scaleBy(res: 13)\n<\/pre>\n<p>\u4ee5\u4e0a\u7a0b\u5e8f\u6267\u884c\u8f93\u51fa\u7ed3\u679c\u4e3a\uff1a<\/p>\n<pre>\n39\n65\n<\/pre>\n<hr>\n<h2>\u7c7b\u578b\u65b9\u6cd5 <\/h2>\n<p>\u5b9e\u4f8b\u65b9\u6cd5\u662f\u88ab\u7c7b\u578b\u7684\u67d0\u4e2a\u5b9e\u4f8b\u8c03\u7528\u7684\u65b9\u6cd5\uff0c\u4f60\u4e5f\u53ef\u4ee5\u5b9a\u4e49\u7c7b\u578b\u672c\u8eab\u8c03\u7528\u7684\u65b9\u6cd5\uff0c\u8fd9\u79cd\u65b9\u6cd5\u5c31\u53eb\u505a\u7c7b\u578b\u65b9\u6cd5\u3002<\/p>\n<p>\u58f0\u660e\u7ed3\u6784\u4f53\u548c\u679a\u4e3e\u7684\u7c7b\u578b\u65b9\u6cd5\uff0c\u5728\u65b9\u6cd5\u7684func\u5173\u952e\u5b57\u4e4b\u524d\u52a0\u4e0a\u5173\u952e\u5b57static\u3002\u7c7b\u53ef\u80fd\u4f1a\u7528\u5173\u952e\u5b57class\u6765\u5141\u8bb8\u5b50\u7c7b\u91cd\u5199\u7236\u7c7b\u7684\u5b9e\u73b0\u65b9\u6cd5\u3002<\/p>\n<p>\u7c7b\u578b\u65b9\u6cd5\u548c\u5b9e\u4f8b\u65b9\u6cd5\u4e00\u6837\u7528\u70b9\u53f7(.)\u8bed\u6cd5\u8c03\u7528\u3002<\/p>\n<pre>\nimport Cocoa\n\nclass Math\n{\n    class func abs(number: Int) -&gt; Int\n    {\n        if number &lt; 0\n        {\n            return (-number)\n        }\n        else\n        {\n            return number\n        }\n    }\n}\n\nstruct absno\n{\n    static func abs(number: Int) -&gt; Int\n    {\n        if number &lt; 0\n        {\n            return (-number)\n        }\n        else\n        {\n            return number\n        }\n    }\n}\n\nlet no = Math.abs(number: -35)\nlet num = absno.abs(number: -5)\n\nprint(no)\nprint(num)\n<\/pre>\n<p>\u4ee5\u4e0a\u7a0b\u5e8f\u6267\u884c\u8f93\u51fa\u7ed3\u679c\u4e3a\uff1a<\/p>\n<pre>\n35\n5\n<\/pre>\n<\/p><\/div>\n<\/p><\/div>\n<span>","protected":false},"excerpt":{"rendered":"<p class=\"excerpt\"><span itemprop=\"description\">Swift \u65b9\u6cd5 Swift \u65b9\u6cd5\u662f\u4e0e\u67d0\u4e9b\u7279\u5b9a\u7c7b\u578b\u76f8\u5173\u8054\u7684\u51fd\u6570 \u5728 Objective-C&hellip;<\/span><\/p>\n<p class=\"more-link-p btn-align-right\"><a class=\"green zoom-btn\" href=\"https:\/\/www.puzi7.net\/?p=539\">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-539","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 \u65b9\u6cd5 - \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=539\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Swift \u65b9\u6cd5 - \u8c31\u5b50\u68cb - Puzi7\" \/>\n<meta property=\"og:description\" content=\"Swift \u65b9\u6cd5 Swift \u65b9\u6cd5\u662f\u4e0e\u67d0\u4e9b\u7279\u5b9a\u7c7b\u578b\u76f8\u5173\u8054\u7684\u51fd\u6570 \u5728 Objective-C&hellip;Read More\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.puzi7.net\/?p=539\" \/>\n<meta property=\"og:site_name\" content=\"\u8c31\u5b50\u68cb - Puzi7\" \/>\n<meta property=\"article:published_time\" content=\"2018-02-23T15:39:06+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=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.puzi7.net\\\/?p=539#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.puzi7.net\\\/?p=539\"},\"author\":{\"name\":\"\u77f3\u8863\",\"@id\":\"https:\\\/\\\/www.puzi7.net\\\/#\\\/schema\\\/person\\\/87dd4941c8ec260c1350b7f41980a190\"},\"headline\":\"Swift \u65b9\u6cd5\",\"datePublished\":\"2018-02-23T15:39:06+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.puzi7.net\\\/?p=539\"},\"wordCount\":39,\"commentCount\":0,\"keywords\":[\"iOS\",\"Swift\"],\"articleSection\":[\"Mobile\",\"Swift\"],\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.puzi7.net\\\/?p=539#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.puzi7.net\\\/?p=539\",\"url\":\"https:\\\/\\\/www.puzi7.net\\\/?p=539\",\"name\":\"Swift \u65b9\u6cd5 - \u8c31\u5b50\u68cb - Puzi7\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.puzi7.net\\\/#website\"},\"datePublished\":\"2018-02-23T15:39:06+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.puzi7.net\\\/#\\\/schema\\\/person\\\/87dd4941c8ec260c1350b7f41980a190\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.puzi7.net\\\/?p=539#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.puzi7.net\\\/?p=539\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.puzi7.net\\\/?p=539#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 \u65b9\u6cd5\"}]},{\"@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 \u65b9\u6cd5 - \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=539","og_locale":"zh_CN","og_type":"article","og_title":"Swift \u65b9\u6cd5 - \u8c31\u5b50\u68cb - Puzi7","og_description":"Swift \u65b9\u6cd5 Swift \u65b9\u6cd5\u662f\u4e0e\u67d0\u4e9b\u7279\u5b9a\u7c7b\u578b\u76f8\u5173\u8054\u7684\u51fd\u6570 \u5728 Objective-C&hellip;Read More","og_url":"https:\/\/www.puzi7.net\/?p=539","og_site_name":"\u8c31\u5b50\u68cb - Puzi7","article_published_time":"2018-02-23T15:39:06+00:00","author":"\u77f3\u8863","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u77f3\u8863","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.puzi7.net\/?p=539#article","isPartOf":{"@id":"https:\/\/www.puzi7.net\/?p=539"},"author":{"name":"\u77f3\u8863","@id":"https:\/\/www.puzi7.net\/#\/schema\/person\/87dd4941c8ec260c1350b7f41980a190"},"headline":"Swift \u65b9\u6cd5","datePublished":"2018-02-23T15:39:06+00:00","mainEntityOfPage":{"@id":"https:\/\/www.puzi7.net\/?p=539"},"wordCount":39,"commentCount":0,"keywords":["iOS","Swift"],"articleSection":["Mobile","Swift"],"inLanguage":"zh-Hans","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.puzi7.net\/?p=539#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.puzi7.net\/?p=539","url":"https:\/\/www.puzi7.net\/?p=539","name":"Swift \u65b9\u6cd5 - \u8c31\u5b50\u68cb - Puzi7","isPartOf":{"@id":"https:\/\/www.puzi7.net\/#website"},"datePublished":"2018-02-23T15:39:06+00:00","author":{"@id":"https:\/\/www.puzi7.net\/#\/schema\/person\/87dd4941c8ec260c1350b7f41980a190"},"breadcrumb":{"@id":"https:\/\/www.puzi7.net\/?p=539#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.puzi7.net\/?p=539"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.puzi7.net\/?p=539#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 \u65b9\u6cd5"}]},{"@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\/539","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=539"}],"version-history":[{"count":0,"href":"https:\/\/www.puzi7.net\/index.php?rest_route=\/wp\/v2\/posts\/539\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.puzi7.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=539"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.puzi7.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=539"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.puzi7.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=539"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}