Skip to content

Instantly share code, notes, and snippets.

View Ingelheim's full-sized avatar

Lukas Ingelheim Ingelheim

View GitHub Profile
import UIKit
import SpriteKit
import ARKit
struct ImageInformation {
let name: String
let description: String
let image: UIImage
}
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() {
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
}
}
}
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)
override func viewDidLoad() {
super.viewDidLoad()
sceneView.delegate = self
sceneView.showsFPS = true
sceneView.showsNodeCount = true
if let scene = SKScene(fileNamed: "Scene") {
sceneView.presentScene(scene)
}
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")!)]
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
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
// Create a session configuration
let configuration = ARWorldTrackingConfiguration()
// Run the view's session
sceneView.session.run(configuration)
}
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
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]