Skip to content

Instantly share code, notes, and snippets.

View RNHTTR's full-sized avatar

Ryan Hatter RNHTTR

  • Astronomer
View GitHub Profile
@RNHTTR
RNHTTR / heightForRowAtIndexPath.swift
Created September 23, 2017 19:38
Example of how to use tableView(_:heightForRowAt:) to adjust the height of a UITableViewCell
// The table views in this app actually don't make use of tableView(_:heightForRowAt:). These table views set the table views'
// rowHeight and estimatedRowHeight properties to UITableViewAutomaticDimension and 110, respectively, and they make use
// of a series of constraints to automatically set each cells' row height.
// Use tableView(_:heightForRowAt:) to set the height for specific table view cells.
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
// Set the row height for the first (zeroth) cell in all section(s) to 100, and set all other cells to 50.
// You can also set the row height for all cells in a section by accessing indexPath.section.
if indexPath.row == 0 {
@RNHTTR
RNHTTR / ARTouchGestureInteractionViewController.swift
Created September 22, 2017 14:09
Interacting with Augmented Reality objects is not as hard as you might think
// Using touch gestures to interact with your Augmented Reality objects actually doesn't involve more ARKit code! Rather,
// you'll have to implement some new SCNKit code and play with a UITapGestureRecognizer from good ol' UIKit. Here we will
// create a Super Mario box, and it will pop up as if you were Mario jumping underneath it!
// If you're jumping straight into this view controller, you might need to update your info.plist (Information Property
// List) file first. Add the key "Privacy - Camera Usage Description" with the corresponding value "This application will
// use your camera for Augmented Reality", or some similarly descriptive note.
// Let's get started!
@RNHTTR
RNHTTR / ARMultipleObjectsViewController.swift
Last active September 22, 2017 13:40
Add a second object (a sphere) to your Augmented Reality space
// Adding a second object to your Augmented Reality space is not much different from adding the first, so we will change
// things up here a bit. Here we will create a sphere in addition to a box and we will give our objects some style.
// If you haven't already, you need to add a key-value pair to your application's Info.plist (Information Property List) file.
// Add the key "Privacy - Camera Usage Description" with the corresponding value "This application will use your camera for
// Augmented Reality", or some similarly descriptive note.
// Let's get started!
// You'll need to import SceneKit to create and edit your objects and ARKit to place it in your augmented reality space.
@RNHTTR
RNHTTR / ARTextViewController.swift
Last active September 22, 2017 13:37
Create a simple 3D text object in augmented reality
// Creating a 3D text object with ARKit isn't overwhelming. It might not be immediately obvious, but these objects could
// be quite valuable moving forward. Imagine dropping a 3D advertisement in someone's augmented reality universe...
// We'll get started in a sec, but first you need to add a key-value pair to your application's Info.plist (Information
// Property List) file. Add the key "Privacy - Camera Usage Description" with the corresponding value "This application
// will use your camera for Augmented Reality", or some similarly descriptive note.
// Let's get started!
// You'll need to import SceneKit to create your object and ARKit to place it in your augmented reality space.
@RNHTTR
RNHTTR / ARBasicObject.swift
Last active November 14, 2018 02:40
Create a basic AR object using ARKit and SCNKit
// Creating a simple Augmented Reality object with ARKit and SceneKit is surprisingly easy! But before you get started, you
// need to add a key-value pair to your application's Info.plist (Information Property List) file. Add the key "Privacy -
// Camera Usage Description" with the corresponding value "This application will use your camera for Augmented Reality", or
// some similarly descriptive note.
// Let's get started!
// You'll need to import SceneKit to create your object and ARKit to place it in your augmented reality space.
import UIKit
import SceneKit