function createArray(w, x, y, z) {
return [w, x, y, z]
}
createArray(1, 4, 6, 3) // [1, 4, 6, 3]
createArray(1, 2, 3, 4) // [1, 2, 3, 4]
createArray("hello", "bye", "test", "morning") // ["hello", "bye", "test", "morning"]
var testArray = [1, 2, 3, 4, 5]
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
import UIKit | |
import SpriteKit | |
import ARKit | |
struct ImageInformation { | |
let name: String | |
let description: String | |
let image: UIImage | |
} |
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
import UIKit | |
class ImageInformationViewController : UIViewController { | |
@IBOutlet weak var nameLabel: UILabel! | |
@IBOutlet weak var imageView: UIImageView! | |
@IBOutlet weak var descriptionText: UITextView! | |
var imageInformation : ImageInformation? | |
override func viewDidLoad() { |
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
override func prepare(for segue: UIStoryboardSegue, sender: Any?) { | |
if segue.identifier == "showImageInformation"{ | |
if let imageInformationVC = segue.destination as? ImageInformationViewController, | |
let actualSelectedImage = selectedImage { | |
imageInformationVC.imageInformation = actualSelectedImage | |
} | |
} | |
} |
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
func view(_ view: ARSKView, nodeFor anchor: ARAnchor) -> SKNode? { | |
if let imageAnchor = anchor as? ARImageAnchor, | |
let referenceImageName = imageAnchor.referenceImage.name, | |
let scannedImage = self.images[referenceImageName] { | |
self.selectedImage = scannedImage | |
self.performSegue(withIdentifier: "showImageInformation", sender: self) | |
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
override func viewDidLoad() { | |
super.viewDidLoad() | |
sceneView.delegate = self | |
sceneView.showsFPS = true | |
sceneView.showsNodeCount = true | |
if let scene = SKScene(fileNamed: "Scene") { | |
sceneView.presentScene(scene) | |
} |
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
var selectedImage : ImageInformation? | |
let images = ["monalisa" : ImageInformation(name: "Mona Lisa", | |
description: "The Mona Lisa is a half-length portrait painting by the Italian Renaissance artist Leonardo da Vinci that has been described as 'the best known, the most visited, the most written about, the most sung about, the most parodied work of art in the world'.", | |
image: UIImage(named: "monalisa")!)] |
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
override func viewWillAppear(_ animated: Bool) { | |
super.viewWillAppear(animated) | |
guard let referenceImages = ARReferenceImage.referenceImages(inGroupNamed: "Mona Lisa Room", bundle: nil) else { | |
fatalError("Missing expected asset catalog resources.") | |
} | |
let configuration = ARWorldTrackingConfiguration() | |
configuration.detectionImages = referenceImages | |
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
override func viewWillAppear(_ animated: Bool) { | |
super.viewWillAppear(animated) | |
// Create a session configuration | |
let configuration = ARWorldTrackingConfiguration() | |
// Run the view's session | |
sceneView.session.run(configuration) | |
} |
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
var setSong = function(songNumber) { | |
if (currentSoundFile) { | |
currentSoundFile.stop(); | |
} | |
currentlyPlayingSongNumber = parseInt(songNumber); | |
currentSongFromAlbum = currentAlbum.songs[songNumber - 1]; | |
currentSoundFile = new buzz.sound(currentSongFromAlbum.audioUrl, { | |
formats: [ 'mp3 '], | |
preload: true |
NewerOlder