Skip to content

Instantly share code, notes, and snippets.

View travisnewby's full-sized avatar
🚀

Travis travisnewby

🚀
View GitHub Profile
@travisnewby
travisnewby / PKCE.swift
Created July 8, 2021 13:11
Client-side implementation of PKCE in Swift
import Foundation
import CryptoKit
///
/// An easy-to-use implementation of the client side of the [PKCE standard](https://datatracker.ietf.org/doc/html/rfc7636).
///
struct PKCE {
typealias PKCECode = String
@travisnewby
travisnewby / Validation.swift
Last active October 12, 2020 15:12
Validation Library
import UIKit
import Combine
protocol Validator {
func validate(_ field: String) -> Validation.ValidationResult
}
enum Validation {
@travisnewby
travisnewby / Simulator Video Command
Created December 14, 2016 16:24
Create a video from the Xcode simulator
xcrun simctl io booted recordVideo ~/Desktop/vidtest.mov
@travisnewby
travisnewby / CMDeviceMotion.swift
Last active November 12, 2022 17:13
Determine the direction of "gaze" of the device in any orientation
extension CMDeviceMotion {
func gaze(atOrientation orientation: UIInterfaceOrientation) -> SCNVector4 {
let attitude = self.attitude.quaternion
let aq = GLKQuaternionMake(Float(attitude.x), Float(attitude.y), Float(attitude.z), Float(attitude.w))
let final: SCNVector4
switch orientation {