diff --git a/bk1ch02p036defaultParameters/bk1ch02p036defaultParameters/ViewController.swift b/bk1ch02p036defaultParameters/bk1ch02p036defaultParameters/ViewController.swift index 23e29d9a5..b1a047f11 100644 --- a/bk1ch02p036defaultParameters/bk1ch02p036defaultParameters/ViewController.swift +++ b/bk1ch02p036defaultParameters/bk1ch02p036defaultParameters/ViewController.swift @@ -18,6 +18,14 @@ func sayStrings(arrayOfStrings:String ...) { for s in arrayOfStrings { print(s) } } +// new in beta 6, variadic can go anywhere + +func sayStrings(arrayOfStrings:String ..., times:Int) { + for _ in 1...times { + for s in arrayOfStrings { print(s) } + } +} + // ignored func say(s:String, times:Int, loudly _:Bool) {Dog().say(s, times:times)} @@ -39,6 +47,15 @@ class ViewController: UIViewController { doThing(b:5, a:10) // legal but don't sayStrings("hey", "ho", "nonny nonny no") + + sayStrings("Mannie", "Moe", "Jack", times:3) + + // print is now variadic + + print("Mannie", 3, true) // Mannie 3 true + + print("Mannie", "Moe", separator:", ", terminator: ", ") + print("Jack") say("hi", times:3, loudly:true) diff --git a/bk1ch04p187generics/bk1ch04p187generics/ViewController.swift b/bk1ch04p187generics/bk1ch04p187generics/ViewController.swift index a73c30bc2..0b63a8f11 100644 --- a/bk1ch04p187generics/bk1ch04p187generics/ViewController.swift +++ b/bk1ch04p187generics/bk1ch04p187generics/ViewController.swift @@ -59,6 +59,8 @@ struct Insect3 : Flier3 { // workaround: +///* + protocol Superflier3 {} protocol Flier3 : Superflier3 { @@ -72,6 +74,8 @@ struct Insect3 : Flier3 { func flockTogetherWith(f:Insect3) {} } +//*/ + func flockTwoTogether2(f1:T, _ f2:T) {} let vd2 : Void = flockTwoTogether2(Bird3(), Bird3()) diff --git a/bk1ch04p194whereClauses2/bk1ch04p194whereClauses2/Base.lproj/LaunchScreen.storyboard b/bk1ch04p194whereClauses2/bk1ch04p194whereClauses2/Base.lproj/LaunchScreen.storyboard index 18278dac2..5807d6eb2 100644 --- a/bk1ch04p194whereClauses2/bk1ch04p194whereClauses2/Base.lproj/LaunchScreen.storyboard +++ b/bk1ch04p194whereClauses2/bk1ch04p194whereClauses2/Base.lproj/LaunchScreen.storyboard @@ -1,7 +1,7 @@ - + - + diff --git a/bk1ch04p196extensions/bk1ch04p196extensions/ViewController.swift b/bk1ch04p196extensions/bk1ch04p196extensions/ViewController.swift index 7a7bd316c..d77d44428 100644 --- a/bk1ch04p196extensions/bk1ch04p196extensions/ViewController.swift +++ b/bk1ch04p196extensions/bk1ch04p196extensions/ViewController.swift @@ -4,7 +4,7 @@ import UIKit extension Array { mutating func shuffle () { - for i in stride(from:self.count-1, to:0, by:-1) { + for i in (0.. [UICollectionViewLayoutAttributes]? { // println("rect") - return self.atts.values.array + return Array(self.atts.values) } } \ No newline at end of file