]> Zhao Yanbai Git Server - acecode.git/commitdiff
add AcePlay
authorAce <acezhao@tencent.com>
Fri, 17 Jun 2016 04:59:23 +0000 (12:59 +0800)
committerAce <acezhao@tencent.com>
Fri, 17 Jun 2016 04:59:23 +0000 (12:59 +0800)
learn/AcePlay/AcePlay.playground/Contents.swift [new file with mode: 0644]
learn/AcePlay/AcePlay.playground/contents.xcplayground [new file with mode: 0644]
learn/AcePlay/AcePlay.playground/playground.xcworkspace/contents.xcworkspacedata [new file with mode: 0644]
learn/AcePlay/AcePlay.playground/playground.xcworkspace/xcuserdata/Ace.xcuserdatad/UserInterfaceState.xcuserstate [new file with mode: 0644]

diff --git a/learn/AcePlay/AcePlay.playground/Contents.swift b/learn/AcePlay/AcePlay.playground/Contents.swift
new file mode 100644 (file)
index 0000000..b64b9e2
--- /dev/null
@@ -0,0 +1,45 @@
+//: Playground - noun: a place where people can play
+
+import UIKit
+
+var str = "Hello, playground.小狗:🐶 锤子:🔨"
+
+
+func printLine(title: String) -> Void {
+    let line = String(format:"[%@]-----------------------------------", title)
+    print(line)
+}
+
+// Index
+var strInx:String.Index = str.startIndex
+strInx.successor()
+print(strInx)
+
+for c in str.characters {
+    print(c, terminator: "")
+}
+print()
+
+// Print separator & terminator
+var company:Array<String> = [ "Apple", "Google", "Facebook", "Tencent" ]
+print(company, separator: "#", terminator: " $$$$$\n")
+
+printLine("Count company Array 1")
+for (i,v) in company.enumerate() {
+    print(i, v, separator: " - ", terminator: "\n")
+}
+
+printLine("Count company Array 2")
+company.insert("Alibaba", atIndex: company.count)
+for i in 0..<company.count {
+    print(i, company[i], separator: " - ")
+}
+company.removeLast()
+
+var someIntsA: [Int] = []
+var someIntsB = [Int]()
+var someIntsC = [Int](count: 10, repeatedValue: 1)
+someIntsA.append(1)
+someIntsB.replaceRange(Range<Int>(0..<someIntsB.count), with: [1,3,4])
+someIntsC.removeAtIndex(4)
+
diff --git a/learn/AcePlay/AcePlay.playground/contents.xcplayground b/learn/AcePlay/AcePlay.playground/contents.xcplayground
new file mode 100644 (file)
index 0000000..5da2641
--- /dev/null
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<playground version='5.0' target-platform='ios'>
+    <timeline fileName='timeline.xctimeline'/>
+</playground>
\ No newline at end of file
diff --git a/learn/AcePlay/AcePlay.playground/playground.xcworkspace/contents.xcworkspacedata b/learn/AcePlay/AcePlay.playground/playground.xcworkspace/contents.xcworkspacedata
new file mode 100644 (file)
index 0000000..919434a
--- /dev/null
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Workspace
+   version = "1.0">
+   <FileRef
+      location = "self:">
+   </FileRef>
+</Workspace>
diff --git a/learn/AcePlay/AcePlay.playground/playground.xcworkspace/xcuserdata/Ace.xcuserdatad/UserInterfaceState.xcuserstate b/learn/AcePlay/AcePlay.playground/playground.xcworkspace/xcuserdata/Ace.xcuserdatad/UserInterfaceState.xcuserstate
new file mode 100644 (file)
index 0000000..57048f1
Binary files /dev/null and b/learn/AcePlay/AcePlay.playground/playground.xcworkspace/xcuserdata/Ace.xcuserdatad/UserInterfaceState.xcuserstate differ