Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
Binary file modified
BIN
+481 Bytes
(100%)
...ground/playground.xcworkspace/xcuserdata/tibor.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import Cocoa | ||
|
||
struct Album { | ||
let title: String | ||
let artist: String | ||
let year: Int | ||
|
||
func printSummary() { | ||
print("\(title) (\(year)) by \(artist)") | ||
} | ||
} | ||
|
||
let red = Album(title: "Red", artist: "Taylor Swift", year: 2012) | ||
let wings = Album(title: "Wings", artist: "BTS", year: 2016) | ||
|
||
print(red.title) | ||
print(wings.artist) | ||
|
||
red.printSummary() | ||
wings.printSummary() | ||
|
||
|
||
struct Game { | ||
var score = 0 { | ||
didSet { | ||
print("Score is now \(score)") | ||
} | ||
} | ||
} | ||
|
||
var game = Game() | ||
game.score += 10 | ||
game.score -= 3 | ||
game.score += 1 | ||
|
||
|
||
struct App { | ||
var contacts = [String]() { | ||
willSet { | ||
print("Current value is: \(contacts)") | ||
print("New value will be: \(newValue)") | ||
} | ||
|
||
didSet { | ||
print("There are now \(contacts.count) contacts.") | ||
print("Old value was \(oldValue)") | ||
} | ||
} | ||
} | ||
|
||
var app = App() | ||
app.contacts.append("Adrian E") | ||
app.contacts.append("Allen W") | ||
app.contacts.append("Ish S") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
<playground version='5.0' target-platform='macos' buildActiveScheme='true' importAppTypes='true'> | ||
<timeline fileName='timeline.xctimeline'/> | ||
</playground> |
7 changes: 7 additions & 0 deletions
7
day-10.playground/playground.xcworkspace/contents.xcworkspacedata
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file added
BIN
+11.4 KB
...ground/playground.xcworkspace/xcuserdata/tibor.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown.