]> Zhao Yanbai Git Server - acecode.git/commitdiff
...
authorAceVest <zhaoyanbai@126.com>
Fri, 17 Jun 2016 16:07:41 +0000 (00:07 +0800)
committerAceVest <zhaoyanbai@126.com>
Fri, 17 Jun 2016 16:07:41 +0000 (00:07 +0800)
learn/AcePlay/AcePlay.playground/Contents.swift
learn/AcePlay/AcePlay.playground/Sources/Basic.swift [new file with mode: 0644]
learn/AcePlay/AcePlay.playground/Sources/Func.swift [new file with mode: 0644]
learn/AcePlay/AcePlay.playground/Sources/Utils.swift [new file with mode: 0644]
learn/AcePlay/AcePlay.playground/playground.xcworkspace/xcuserdata/Ace.xcuserdatad/UserInterfaceState.xcuserstate
learn/AcePlay/AcePlay.playground/xcuserdata/Ace.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist [new file with mode: 0644]
tools/AceBox/AceBox.xcodeproj/project.xcworkspace/xcuserdata/Ace.xcuserdatad/UserInterfaceState.xcuserstate
tools/AceBox/AceBox.xcodeproj/xcuserdata/Ace.xcuserdatad/xcschemes/AceBox.xcscheme
tools/AceBox/AceBox/FirstViewController.swift
tools/AceBox/AceBox/Images.xcassets/HeadImg.imageset/Contents.json

index 0b4e3078dbd4dbfb56324a5d1bde10570de92969..2a17f16b8f22ff6bbc00d4602e100689596fb114 100644 (file)
@@ -2,44 +2,7 @@
 
 import UIKit
 
-var str = "Hello, playground.小狗:🐶 锤子:🔨"
 
+SwiftBasics()
 
-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[0], company[1], company[2], company[3], 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)
-
+SwiftFunctions()
diff --git a/learn/AcePlay/AcePlay.playground/Sources/Basic.swift b/learn/AcePlay/AcePlay.playground/Sources/Basic.swift
new file mode 100644 (file)
index 0000000..dddda1f
--- /dev/null
@@ -0,0 +1,105 @@
+import UIKit
+
+public
+func SwiftBasics() -> Void {
+    let str = "Hello, playground.小狗:🐶 锤子:🔨"
+
+    // Index
+    let 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[0], company[1], company[2], company[3], separator: "#", terminator: " $$$$$\n")
+
+    printLine("Count company Array 1")
+    for (i,v) in company.enumerate() {  // enumerate 返回的是 index value 组成的元组
+        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)
+    someIntsC[1...4] = [1, 2, 3, 4, 5, 6]  //实际赋值量可以与下标Range量不等
+
+    printLine("Set")
+
+    // Set 只能存储能提供计算出hash value的类型
+    str.hashValue
+    3.1415926.hashValue
+    2005061325.hashValue
+    true.hashValue
+
+    //var SetA: Set<Int> = []
+    var SetB = Set<Character>()
+    var SetC: Set<String> = ["ASM", "C", "C++", "go", "Swift"]
+    //var SetD: Set = ["mov", "pop", "push", "xchg"]  // 可以通过数组类型推断出Set的类型
+    SetB.insert("A")
+    SetB.insert("c")
+    SetB.insert("c")
+    SetB.count
+    //SetC.removeFirst()
+    SetC.remove("ASM")
+
+    if let removedVal = SetC.remove("ASM") {
+        print("\(removedVal) I'm over it.")
+    } else {
+        print("I never much cared for that.")
+        SetC.insert("ASM")
+    }
+
+    if SetC.contains("Swift") {
+        print("SetC Contains Swift")
+    }
+
+    for v in SetC.sort() {
+        print(v)
+    }
+
+    printLine("Dictionary")
+    //var DictA = Dictionary<Int, String>()
+    //var DictB = ["KA":"VA", "KB":"VB", "KC":"VC"]
+    //var DictC: [String:String] = [:]
+    var DictD = [Int:String]()
+
+    DictD[1]  = "V1"
+    DictD[4]  = "V2"
+    DictD[99] = "V3"
+    DictD[36] = "F4"
+    if let oldValue = DictD.updateValue("V4", forKey: 36) { // means: if let oldValue = DictD[36]
+        print("The old value for Key:36 was \(oldValue)")
+    }
+
+    print("DictD Item Count: ", DictD.count)
+
+    for (k, v) in DictD {
+        print("Key:", k, " Value: ", v)
+    }
+
+    for key in DictD.keys.sort() {
+        print(key)
+    }
+
+    for value in DictD.values.sort() {
+        print(value)
+    }
+
+    let keys = [Int](DictD.keys)
+    print(keys)
+}
diff --git a/learn/AcePlay/AcePlay.playground/Sources/Func.swift b/learn/AcePlay/AcePlay.playground/Sources/Func.swift
new file mode 100644 (file)
index 0000000..344f9ab
--- /dev/null
@@ -0,0 +1,13 @@
+//import Foundation
+import UIKit
+
+func Hello() -> Void {
+    print("Hello Swift World")
+}
+
+
+public
+func SwiftFunctions() -> Void {
+    printLine("Functions")
+    Hello()
+}
\ No newline at end of file
diff --git a/learn/AcePlay/AcePlay.playground/Sources/Utils.swift b/learn/AcePlay/AcePlay.playground/Sources/Utils.swift
new file mode 100644 (file)
index 0000000..ece3a6f
--- /dev/null
@@ -0,0 +1,7 @@
+import UIKit
+
+public
+func printLine(title: String) -> Void {
+    let line = String(format:"[%@]-----------------------------------", title)
+    print(line)
+}
\ No newline at end of file
index 0eaab8357c04a85c43904d9a2603ca05f9b9890f..4665619d02c5e2c18e12d993b0cd6ba036aedea6 100644 (file)
Binary files a/learn/AcePlay/AcePlay.playground/playground.xcworkspace/xcuserdata/Ace.xcuserdatad/UserInterfaceState.xcuserstate and b/learn/AcePlay/AcePlay.playground/playground.xcworkspace/xcuserdata/Ace.xcuserdatad/UserInterfaceState.xcuserstate differ
diff --git a/learn/AcePlay/AcePlay.playground/xcuserdata/Ace.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/learn/AcePlay/AcePlay.playground/xcuserdata/Ace.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
new file mode 100644 (file)
index 0000000..8faff43
--- /dev/null
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Bucket
+   type = "1"
+   version = "2.0">
+   <Breakpoints>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "No"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "AcePlay.playground/Sources/Basic.swift"
+            timestampString = "487872216.908713"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "6"
+            endingLineNumber = "6"
+            landmarkName = "SwiftBasics()"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "AcePlay.playground/Sources/Basic.swift"
+            timestampString = "487872228.312092"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "9"
+            endingLineNumber = "9"
+            landmarkName = "SwiftBasics()"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+   </Breakpoints>
+</Bucket>
index 6cd4597765551e90ee052a75cf93e63127ff4745..fbd0cc4fba751a61cfbb5eac3f3a8e4b49927941 100644 (file)
Binary files a/tools/AceBox/AceBox.xcodeproj/project.xcworkspace/xcuserdata/Ace.xcuserdatad/UserInterfaceState.xcuserstate and b/tools/AceBox/AceBox.xcodeproj/project.xcworkspace/xcuserdata/Ace.xcuserdatad/UserInterfaceState.xcuserstate differ
index 555fac580d8cd17e07fd5c5ea15c179acbb2e283..91bcb129a7962469ce5ee0467e51977af6ac73de 100644 (file)
@@ -15,7 +15,7 @@
             <BuildableReference
                BuildableIdentifier = "primary"
                BlueprintIdentifier = "50A4F2741AF2154100DB7E36"
-               BuildableName = "AceBox.app"
+               BuildableName = "Ace.app"
                BlueprintName = "AceBox"
                ReferencedContainer = "container:AceBox.xcodeproj">
             </BuildableReference>
@@ -57,7 +57,7 @@
          <BuildableReference
             BuildableIdentifier = "primary"
             BlueprintIdentifier = "50A4F2741AF2154100DB7E36"
-            BuildableName = "AceBox.app"
+            BuildableName = "Ace.app"
             BlueprintName = "AceBox"
             ReferencedContainer = "container:AceBox.xcodeproj">
          </BuildableReference>
@@ -80,7 +80,7 @@
          <BuildableReference
             BuildableIdentifier = "primary"
             BlueprintIdentifier = "50A4F2741AF2154100DB7E36"
-            BuildableName = "AceBox.app"
+            BuildableName = "Ace.app"
             BlueprintName = "AceBox"
             ReferencedContainer = "container:AceBox.xcodeproj">
          </BuildableReference>
@@ -99,7 +99,7 @@
          <BuildableReference
             BuildableIdentifier = "primary"
             BlueprintIdentifier = "50A4F2741AF2154100DB7E36"
-            BuildableName = "AceBox.app"
+            BuildableName = "Ace.app"
             BlueprintName = "AceBox"
             ReferencedContainer = "container:AceBox.xcodeproj">
          </BuildableReference>
index da2377430e93f261a0015f495544d2631b28c061..e10c6badf208ec08531e0ea3ddec5f8f5e63d335 100644 (file)
@@ -15,6 +15,7 @@ class FirstViewController: UIViewController {
         // Do any additional setup after loading the view, typically from a nib.
         //view.backgroundColor = UIColor.blueColor()
         view.backgroundColor = UIColor(red: 0, green: 0.47843137250000001, blue: 1, alpha: 1)
+
     }
 
     override func didReceiveMemoryWarning() {
index e98bfe26abb9beb88e0cb0ce222ead3a8bf43bfe..1772ed3a6c4ca72b49cf5f7689a82ddfb2d7692d 100644 (file)
@@ -4,6 +4,14 @@
       "idiom" : "universal",
       "filename" : "IMG_4358 copy.JPG",
       "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "3x"
     }
   ],
   "info" : {