Skip to content
Open

update #2668

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>DocumentThumbnailConfiguration</key>
<dict>
<key>accentColorHash</key>
<data>
G0yRM9pzpxEyJAQxRAJ2WrDSP9NioWfW8MZbshURPZQ=
</data>
<key>appIconHash</key>
<data>
d693i1Gr1KPFHF3dlyBKnDrmFOvMt1pgbDtoZa7WdE4=
</data>
<key>thumbnailIsPrerendered</key>
<false/>
</dict>
</dict>
</plist>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>TemplatePageFilename</key>
<string>Template.playgroundpage</string>
<key>Version</key>
<string>1.0</string>
<key>Name</key>
<string>Answers</string>
<key>InitialUserPages</key>
<array>
<string>Text.playgroundpage</string>
<string>API Overview.playgroundpage</string>
<string>Quiz.playgroundpage</string>
<string>ChooseYourOwnAdventure.playgroundpage</string>
<string>CrystalBall.playgroundpage</string>
</array>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//
// LiveView.swift
//
// Copyright © 2016-2020 Apple Inc. All rights reserved.
//

import Book

setupLiveView()
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Version</key>
<string>1.0</string>
<key>Name</key>
<string>Types</string>
<key>LiveViewMode</key>
<string>VisibleByDefault</string>
<key>LiveViewEdgeToEdge</key>
<true/>
<key>UserModuleSourceFilesToOpen</key>
<array>
<string>UserModules/MyFiles.playgroundmodule/Sources/SharedCode.swift</string>
</array>
<key>UserModuleCodeCompletionDirectives</key>
<array>
<string>identifier, hide, setupLiveView()</string>
</array>
</dict>
</plist>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
//#-hidden-code
//
// main.swift
//
// Copyright © 2016-2020 Apple Inc. All rights reserved.
//
//#-end-hidden-code
//#-code-completion(identifier, hide, setupLiveView())
//#-hidden-code
import Foundation
//#-end-hidden-code
//#-editable-code Tap to enter code
import UIKit

// /*#-localizable-zone(k1)*/1. Show a string, date, image, or number/*#-end-localizable-zone*/.
show("/*#-localizable-zone(text1)*/Hello, World!/*#-end-localizable-zone*/")

// /*#-localizable-zone(k2)*/2. Ask for an open string response/*#-end-localizable-zone*/.
ask("/*#-localizable-zone(text2)*/What’s your nickname?/*#-end-localizable-zone*/")

// /*#-localizable-zone(k3)*/3. Ask for a choice from a set of strings/*#-end-localizable-zone*/.
show("/*#-localizable-zone(text3)*/What’s your favorite color?/*#-end-localizable-zone*/")
let color = askForChoice("/*#-localizable-zone(text3b)*/Color/*#-end-localizable-zone*/", strings: ["/*#-localizable-zone(text4)*/Blue/*#-end-localizable-zone*/", "/*#-localizable-zone(text5)*/Green/*#-end-localizable-zone*/", "/*#-localizable-zone(text6)*/Orange/*#-end-localizable-zone*/", "/*#-localizable-zone(text7)*/Purple/*#-end-localizable-zone*/", "/*#-localizable-zone(text8)*/Red/*#-end-localizable-zone*/", "/*#-localizable-zone(text9)*/Yellow/*#-end-localizable-zone*/"])

// /*#-localizable-zone(k4)*/4. Ask for a choice from a set of images/*#-end-localizable-zone*/.
let animals: [UIImage] = ["🐌".image(), "🐥".image(), "🐋".image(), "🐎".image(), "🦍".image()]
show("/*#-localizable-zone(text10)*/Choose your favorite animal./*#-end-localizable-zone*/")
let animal = askForChoice(images: animals)

// /*#-localizable-zone(k5)*/5. Ask for a date/*#-end-localizable-zone*/.
show("/*#-localizable-zone(text11)*/What’s your birthdate?/*#-end-localizable-zone*/")
let birthdate = askForDate("/*#-localizable-zone(text12)*/Birthdate/*#-end-localizable-zone*/")

// /*#-localizable-zone(k6)*/6. Ask for a number/*#-end-localizable-zone*/.
show("/*#-localizable-zone(text13)*/What’s your favorite number?/*#-end-localizable-zone*/")
let number = askForNumber("/*#-localizable-zone(text14)*/Number/*#-end-localizable-zone*/")

// /*#-localizable-zone(k7)*/7. Pause until the user taps the button/*#-end-localizable-zone*/.
pauseUntilTapped(message: "/*#-localizable-zone(text15)*/Ready to continue?/*#-end-localizable-zone*/")

//#-end-editable-code
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//
// LiveView.swift
//
// Copyright © 2016-2020 Apple Inc. All rights reserved.
//

import Book

setupLiveView()
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Version</key>
<string>1.0</string>
<key>Name</key>
<string>Text</string>
<key>LiveViewMode</key>
<string>VisibleByDefault</string>
<key>LiveViewEdgeToEdge</key>
<true/>
<key>UserModuleSourceFilesToOpen</key>
<array>
<string>UserModules/MyFiles.playgroundmodule/Sources/Adventure.swift</string>
</array>
<key>UserModuleCodeCompletionDirectives</key>
<array>
<string>identifier, hide, setupLiveView()</string>
</array>
</dict>
</plist>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//#-hidden-code
//
// main.swift
//
// Copyright © 2016-2020 Apple Inc. All rights reserved.
//
//#-end-hidden-code
//#-code-completion(identifier, hide, setupLiveView())
//#-hidden-code
import Foundation
import UIKit
//#-end-hidden-code
//#-editable-code Tap to enter code
let bakingAdventure = Adventure()

bakingAdventure.start()
//#-end-editable-code
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//
// LiveView.swift
//
// Copyright © 2016-2020 Apple Inc. All rights reserved.
//

import Book

setupLiveView()
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Version</key>
<string>1.0</string>
<key>Name</key>
<string>Types</string>
<key>LiveViewMode</key>
<string>VisibleByDefault</string>
<key>LiveViewEdgeToEdge</key>
<true/>
<key>UserModuleCodeCompletionDirectives</key>
<array>
<string>identifier, hide, setupLiveView()</string>
</array>
</dict>
</plist>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
//#-hidden-code
//
// main.swift
//
// Copyright © 2016-2020 Apple Inc. All rights reserved.
//
//#-end-hidden-code
//#-code-completion(identifier, hide, setupLiveView())
//#-hidden-code
import Foundation
//#-end-hidden-code
//#-editable-code Tap to enter code
/// /*#-localizable-zone(fortune1)*/The possible fortunes of the crystal ball/*#-end-localizable-zone*/.
var fortunes: [String] = [
"/*#-localizable-zone(key1)*/Your future is quite uncertain./*#-end-localizable-zone*/",
"/*#-localizable-zone(key2)*/You will find happiness and joy unexpectedly./*#-end-localizable-zone*/",
"/*#-localizable-zone(key3)*/In a dream, your wishes will reveal themselves./*#-end-localizable-zone*/",
"/*#-localizable-zone(key4)*/The stars have aligned for you today./*#-end-localizable-zone*/",
"/*#-localizable-zone(key5)*/Be careful of signs that lead to nowhere./*#-end-localizable-zone*/",
"/*#-localizable-zone(key6)*/A sliver of fortune is ahead of you, if you know where to look./*#-end-localizable-zone*/",
"/*#-localizable-zone(key7)*/The answers to your future lie in your past./*#-end-localizable-zone*/",
"/*#-localizable-zone(key8)*/Be curious and you shall be rewarded./*#-end-localizable-zone*/",
"/*#-localizable-zone(key9)*/Everything in moderation is best practiced in moderation./*#-end-localizable-zone*/",
"/*#-localizable-zone(key10)*/Be kind to yourself and you will see that others do the same./*#-end-localizable-zone*/",
"/*#-localizable-zone(key11)*/Don’t forget the little things. They always add up to big things./*#-end-localizable-zone*/"

]


var firstShake = true

// /*#-localizable-zone(fortune3)*/The run loop for the crystal ball continues indefinitely until you stop running the code/*#-end-localizable-zone*/.
while true {
show("🔮".image())
if firstShake {
show("/*#-localizable-zone(key16)*/The crystal ball shall reveal your future path, if you so choose./*#-end-localizable-zone*/")
show("/*#-localizable-zone(key17)*/Before you look into the ball, clear your mind, quiet your thoughts, focus your intentions. Then, ask your question:/*#-end-localizable-zone*/")
ask("/*#-localizable-zone(key18)*/What question burns in your heart?/*#-end-localizable-zone*/")
firstShake = false
} else {
ask("/*#-localizable-zone(key81818181)*/The stone of energy is strong, ask another...if you dare./*#-end-localizable-zone*/")
}

pauseUntilTapped(message: "/*#-localizable-zone(key19)*/Now concentrate and look into the crystal ball, oracle./*#-end-localizable-zone*/")
show(fortunes.randomElement() ?? "")
}
//#-end-editable-code
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//
// LiveView.swift
//
// Copyright © 2016-2020 Apple Inc. All rights reserved.
//

import Book

setupLiveView()
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Version</key>
<string>1.0</string>
<key>Name</key>
<string>Text</string>
<key>LiveViewMode</key>
<string>VisibleByDefault</string>
<key>LiveViewEdgeToEdge</key>
<true/>
<key>UserModuleSourceFilesToOpen</key>
<array>
<string>UserModules/MyFiles.playgroundmodule/Sources/Quiz.swift</string>
</array>
<key>UserModuleCodeCompletionDirectives</key>
<array>
<string>identifier, hide, setupLiveView()</string>
</array>
</dict>
</plist>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//#-hidden-code
//
// main.swift
//
// Copyright © 2016-2020 Apple Inc. All rights reserved.
//
//#-end-hidden-code
//#-code-completion(identifier, hide, setupLiveView())
//#-hidden-code
import Foundation
import UIKit
//#-end-hidden-code
//#-editable-code Tap to enter code
let quiz = Quiz()
quiz.start()

//#-end-editable-code
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//
// LiveView.swift
//
// Copyright © 2016-2020 Apple Inc. All rights reserved.
//

import Book

setupLiveView()
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Version</key>
<string>1.0</string>
<key>Name</key>
<string>Text</string>
<key>LiveViewMode</key>
<string>VisibleByDefault</string>
<key>LiveViewEdgeToEdge</key>
<true/>
<key>UserModuleCodeCompletionDirectives</key>
<array>
<string>identifier, hide, setupLiveView()</string>
</array>
</dict>
</plist>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//#-hidden-code
//
// main.swift
//
// Copyright © 2016-2020 Apple Inc. All rights reserved.
//
//#-end-hidden-code
//#-code-completion(identifier, hide, setupLiveView())
//#-hidden-code
import Foundation
import UIKit
//#-end-hidden-code
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//
// LiveView.swift
//
// Copyright © 2016-2020 Apple Inc. All rights reserved.
//

import Book

setupLiveView()
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Version</key>
<string>1.0</string>
<key>Name</key>
<string>Text</string>
<key>LiveViewMode</key>
<string>VisibleByDefault</string>
<key>LiveViewEdgeToEdge</key>
<true/>
<key>UserModuleSourceFilesToOpen</key>
<array>
<string>UserModules/MyFiles.playgroundmodule/Sources/SharedCode.swift</string>
</array>
<key>UserModuleCodeCompletionDirectives</key>
<array>
<string>identifier, hide, setupLiveView()</string>
</array>
</dict>
</plist>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//#-hidden-code
//
// main.swift
//
// Copyright © 2016-2020 Apple Inc. All rights reserved.
//
//#-end-hidden-code
//#-code-completion(identifier, hide, setupLiveView())
//#-hidden-code
import Foundation
//#-end-hidden-code
//#-editable-code Tap to enter code
show("/*#-localizable-zone(whatIsYourNameText)*/What’s your name?/*#-end-localizable-zone*/")

let name = ask("/*#-localizable-zone(nameText)*/Name/*#-end-localizable-zone*/")

show("/*#-localizable-zone(hiText)*/Hi /*#-end-localizable-zone*/" + name)

//#-end-editable-code
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading