diff --git a/.DS_Store b/.DS_Store index 02e540c..1e85c6a 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/Playground.swift b/Playground.swift index ced05e3..d247281 100644 --- a/Playground.swift +++ b/Playground.swift @@ -10,6 +10,13 @@ protocol Vehicle { struct Train: Vehicle { var name: String var color = "white" + var delay = 0 // nicht im protocol + func delayed(minutes: Int) -> Train { + var train = self + train.delay = minutes + return train + } + } struct ICE: Vehicle { @@ -30,10 +37,13 @@ struct Bike: Vehicle { #Playground { var greeting = "Hallo Playground" var bike = Bike.trek - var train = Train(name:"TGV") + var train = Train(name:"ICE") bike.description bike.description = "Mein Rad" bike.description + train + train.delayed(minutes: 23) + // write code here } diff --git a/TheSwiftWeek.xcodeproj/project.xcworkspace/xcuserdata/rohing73.xcuserdatad/UserInterfaceState.xcuserstate b/TheSwiftWeek.xcodeproj/project.xcworkspace/xcuserdata/rohing73.xcuserdatad/UserInterfaceState.xcuserstate index 02f8009..d34902b 100644 Binary files a/TheSwiftWeek.xcodeproj/project.xcworkspace/xcuserdata/rohing73.xcuserdatad/UserInterfaceState.xcuserstate and b/TheSwiftWeek.xcodeproj/project.xcworkspace/xcuserdata/rohing73.xcuserdatad/UserInterfaceState.xcuserstate differ