From: AceVest Date: Fri, 17 Jun 2016 16:07:41 +0000 (+0800) Subject: ... X-Git-Url: http://zhaoyanbai.com/repos/man.dnssec-revoke.html?a=commitdiff_plain;h=7adae3c06a0766b591b388350873835dc9d6e939;p=acecode.git ... --- diff --git a/learn/AcePlay/AcePlay.playground/Contents.swift b/learn/AcePlay/AcePlay.playground/Contents.swift index 0b4e307..2a17f16 100644 --- a/learn/AcePlay/AcePlay.playground/Contents.swift +++ b/learn/AcePlay/AcePlay.playground/Contents.swift @@ -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 = [ "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..(0.. 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 = [ "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..(0.. = [] + var SetB = Set() + var SetC: Set = ["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() + //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 index 0000000..344f9ab --- /dev/null +++ b/learn/AcePlay/AcePlay.playground/Sources/Func.swift @@ -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 index 0000000..ece3a6f --- /dev/null +++ b/learn/AcePlay/AcePlay.playground/Sources/Utils.swift @@ -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 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 index 0eaab83..4665619 100644 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 index 0000000..8faff43 --- /dev/null +++ b/learn/AcePlay/AcePlay.playground/xcuserdata/Ace.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -0,0 +1,39 @@ + + + + + + + + + + + + + diff --git a/tools/AceBox/AceBox.xcodeproj/project.xcworkspace/xcuserdata/Ace.xcuserdatad/UserInterfaceState.xcuserstate b/tools/AceBox/AceBox.xcodeproj/project.xcworkspace/xcuserdata/Ace.xcuserdatad/UserInterfaceState.xcuserstate index 6cd4597..fbd0cc4 100644 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 diff --git a/tools/AceBox/AceBox.xcodeproj/xcuserdata/Ace.xcuserdatad/xcschemes/AceBox.xcscheme b/tools/AceBox/AceBox.xcodeproj/xcuserdata/Ace.xcuserdatad/xcschemes/AceBox.xcscheme index 555fac5..91bcb12 100644 --- a/tools/AceBox/AceBox.xcodeproj/xcuserdata/Ace.xcuserdatad/xcschemes/AceBox.xcscheme +++ b/tools/AceBox/AceBox.xcodeproj/xcuserdata/Ace.xcuserdatad/xcschemes/AceBox.xcscheme @@ -15,7 +15,7 @@ @@ -57,7 +57,7 @@ @@ -80,7 +80,7 @@ @@ -99,7 +99,7 @@ diff --git a/tools/AceBox/AceBox/FirstViewController.swift b/tools/AceBox/AceBox/FirstViewController.swift index da23774..e10c6ba 100644 --- a/tools/AceBox/AceBox/FirstViewController.swift +++ b/tools/AceBox/AceBox/FirstViewController.swift @@ -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() { diff --git a/tools/AceBox/AceBox/Images.xcassets/HeadImg.imageset/Contents.json b/tools/AceBox/AceBox/Images.xcassets/HeadImg.imageset/Contents.json index e98bfe2..1772ed3 100644 --- a/tools/AceBox/AceBox/Images.xcassets/HeadImg.imageset/Contents.json +++ b/tools/AceBox/AceBox/Images.xcassets/HeadImg.imageset/Contents.json @@ -4,6 +4,14 @@ "idiom" : "universal", "filename" : "IMG_4358 copy.JPG", "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" } ], "info" : {