This file contains hidden or 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
| import SwiftUI | |
| import SpriteKit | |
| struct GameView: View { | |
| @ObservedObject var gameScene = GameScene() | |
| var scene: SKScene { | |
| let scene = gameScene | |
| scene.scaleMode = .resizeFill | |
| scene.anchorPoint = CGPoint(x: 0.5, y: 0.5) |
This file contains hidden or 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
| import Foundation | |
| /* | |
| Loop is used to iterate over a sequence, such as items in an array, ranges of numbers, or characters in a string. | |
| Loop will execute a block of code repeatedly, as long as certain conditions are met. | |
| */ | |
| let vegDrawer = ["🫑", "🍅", "🥕", "🥬", "🥦"] | |
| func foodPrep(veg: String) { |
This file contains hidden or 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
| import UIKit | |
| var greeting = "Hello, playground" | |
| var today = "Sunday" //assigning value | |
| if today == "Friday" { //ngecek | |
| print("Play 'Last Friday Night' by Katy Perry") | |
| } else if today == "Sunday" { | |
| print("Play 'Sunday Morning' by Maroon Five") |
This file contains hidden or 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
| /* | |
| This is the lyric of Baby Shark: | |
| ----- | |
| Baby shark, doo doo doo doo doo doo | |
| Baby shark, doo doo doo doo doo doo | |
| Baby shark, doo doo doo doo doo doo | |
| Baby shark! | |
| Mommy shark, doo doo doo doo doo doo | |
| Mommy shark, doo doo doo doo doo doo |
This file contains hidden or 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
| /* 1. | |
| This is the lyric of Finger Family: | |
| ----- | |
| daddy finger, daddy finger | |
| where are you? | |
| here I am, here I am | |
| how do you do? | |
| mommy finger, mommy finger |
This file contains hidden or 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
| import UIKit | |
| /* 1. | |
| Some people LOVE music. They listen to music almost all the time, more than 50 times per day. Let's call them the 'Music Junkie'. | |
| Some other occasionally listen to music. They listen to music 10 to 50 times per day. Let's call them the 'Music Enjoyer'. | |
| And some other choose not to have music at all. So, zero times. Let's call them 'No-music Folk'. | |
| |-------------------- |--------------------------------- | | |
| |numberOfPlayedMusic | Print Result | | |
| |-------------------- |--------------------------------- | |
This file contains hidden or 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
| var today = "Wednesday" | |
| //1. if | |
| if today == "Friday" { | |
| print("Play 'Last Friday Night' by Katy Perry") | |
| } | |
| //2. if-else | |
| if today == "Friday" { | |
| print("Play 'Last Friday Night' by Katy Perry") |
This file contains hidden or 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
| import Foundation | |
| import AVFoundation | |
| class AudioHelper: NSObject, AVAudioPlayerDelegate { | |
| var player: AVAudioPlayer? | |
| class var defaultHelper: AudioHelper { | |
| struct Static { | |
| static let instance: AudioHelper = AudioHelper() | |
| } |
NewerOlder