{"id":501,"date":"2017-04-12T23:05:50","date_gmt":"2017-04-12T15:05:50","guid":{"rendered":"http:\/\/188.131.173.16\/?p=501"},"modified":"2017-04-12T23:05:50","modified_gmt":"2017-04-12T15:05:50","slug":"swift%e5%ad%a6%e4%b9%a0%e7%ac%94%e8%ae%b0","status":"publish","type":"post","link":"https:\/\/li-yang.cn\/?p=501","title":{"rendered":"Swift\u5b66\u4e60\u7b14\u8bb0"},"content":{"rendered":"<p><!--more-->\u5165\u4e86Mac\u7684\u5751\u5f00\u59cb\u5b66Swift\u3002<br \/>\n\u4ee5\u4e0b\u662fSwift\u7684\u5b66\u4e60\u7b14\u8bb0\u3002\u683c\u5f0f\u5f88\u4e71\uff0c\u7ed9\u81ea\u5df1\u770b\u7684\u3002\u3002<\/p>\n<hr \/>\n<p>\u4e00\u3001\u57fa\u672c\u6570\u636e\u7c7b\u578b<br \/>\n\u5e38\u91cf\u548c\u53d8\u91cf let\/var<br \/>\nInt\/Double,Float\/String\/Bool\/Tuples\/Optionals<br \/>\nlet A:int = 1<br \/>\nlet B:String = &#8220;test&#8221;<br \/>\nlet C:Bool = true<br \/>\nif C{<br \/>\nprint(&#8220;true&#8221;)<br \/>\n}<br \/>\nThisIsTuples = {true , 200 ,&#8221;ok&#8221;}<br \/>\nThisIsTuples.1<br \/>\nlet D:int?<br \/>\nD = 12<\/p>\n<hr \/>\n<p>\u57fa\u672c\u8fd0\u7b97\u7b26<br \/>\n+ &#8211; * \/ %<br \/>\nvar c =1<br \/>\nc++<br \/>\n++c<br \/>\n\u6bd4\u8f83\u64cd\u4f5c\u7b26<br \/>\n==\/\uff01=\/&lt;\/&gt;\/&lt;=\/&gt;=\/===\/!==<br \/>\n\u6761\u4ef6\u8fd0\u7b97\u7b26<br \/>\nscore &gt;=60?&#8221;\u53ca\u683c&#8221;:&#8221;\u4e0d\u53ca\u683c&#8221;<br \/>\na??b \u00a0 \u00a0 \u00a0a!=Nil?a!:b<br \/>\n\u533a\u95f4\u8fd0\u7b97\u7b26<br \/>\n[a,b] \u00a0 a..b<br \/>\n[a,b) \u00a0 \u00a0a..&lt;b<br \/>\nfor i in 1&#8230;9{i*i*i}<br \/>\nfor x in 0..&lt;A.count{print(A[x])}<\/p>\n<hr \/>\n<p>\u6570\u7ec4<br \/>\nvar array = [&#8220;a&#8221;,&#8221;b&#8221;,&#8221;c&#8221;]\u5b58\u50a8\u540c\u7c7b\u578b\u7684\u6570\u636e<br \/>\nvar array2:[String] = [&#8220;a&#8221;,&#8221;b&#8221;,&#8221;c&#8221;]<br \/>\nvar array3:Array&lt;String&gt; = [&#8220;a&#8221;,&#8221;b&#8221;,&#8221;c&#8221;]<br \/>\n\u7a7a\u6570\u7ec4 var array =[Int]()<br \/>\n\u6570\u7ec4\u7684\u4fee\u6539<br \/>\narray6.isEmpty<br \/>\narray6.count<br \/>\narray6.insert(6, at: 2)<br \/>\narray6.remove(at: 1)<br \/>\narray6.removeLast()<br \/>\narray6<br \/>\narray6[0&#8230;1]=[1,2,3,4]<br \/>\n&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-501","post","type-post","status-publish","format-standard","hentry","category-4"],"_links":{"self":[{"href":"https:\/\/li-yang.cn\/index.php?rest_route=\/wp\/v2\/posts\/501","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/li-yang.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/li-yang.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/li-yang.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/li-yang.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=501"}],"version-history":[{"count":0,"href":"https:\/\/li-yang.cn\/index.php?rest_route=\/wp\/v2\/posts\/501\/revisions"}],"wp:attachment":[{"href":"https:\/\/li-yang.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=501"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/li-yang.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=501"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/li-yang.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=501"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}