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 SwiftUI | |
import MultipeerConnectivity | |
import Combine | |
let feedback = PassthroughSubject<CGPoint,Never>() | |
let screenSize: CGRect = UIScreen.main.bounds | |
let screenWidth: CGFloat = UIScreen.main.bounds.width | |
let screenHeight: CGFloat = UIScreen.main.bounds.height |
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 Foundation | |
import MultipeerConnectivity | |
import SwiftUI | |
import os | |
class MultipeerSession: NSObject, ObservableObject { | |
static var shared = MultipeerSession() | |
private let serviceType = "connect" | |
private let myPeerId = MCPeerID(displayName: UIDevice.current.name) |
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 renderer(_ renderer: SCNSceneRenderer, updateAtTime time: TimeInterval) { | |
lastTime = time | |
if time > spawnTime { | |
if faceAnchor != nil { | |
DispatchQueue.main.async { [self] in | |
self.cubeNode.simdOrientation = faceAnchor!.leftEyeTransform.orientation | |
let leftOut = faceAnchor?.blendShapes[.eyeLookInLeft]?.doubleValue | |
let rightOut = faceAnchor?.blendShapes[.eyeLookInRight]?.doubleValue |
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
self.cubeNode.simdOrientation = faceAnchor!.leftEyeTransform.orientation | |
let newX = (satelliteNode.worldPosition.x * 100).rounded() / 100 | |
let newY = (satelliteNode.worldPosition.y * 100).rounded() / 100 | |
let formatter = NumberFormatter() | |
formatter.numberStyle = .decimal | |
formatter.maximumFractionDigits = 2 | |
let number = NSNumber(value: newX) |
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
class Coordinator: NSObject, ARSCNViewDelegate, ARSessionDelegate { | |
private var trackingView:ARSCNView | |
private var sphereNode: SCNNode! | |
private var cubeNode: SCNNode! | |
init(_ view: ARSCNView) { | |
self.trackingView = view | |
super.init() |
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
struct PassForm: View { | |
@ObservedObject var model: PassModel | |
@State private var buttonIsDisabled = true | |
var body: some View { | |
VStack { | |
Text("Password Form") | |
.font(.headline) |
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
struct ContentView: View { | |
@State var image:UIImage! | |
var body: some View { | |
if image == nil { | |
TextView() | |
.onTapGesture { | |
image = TextView().snapshot() | |
let fileManager = FileManager.default | |
let cacheDirectory = fileManager.urls(for: .documentDirectory, in: .userDomainMask).first |
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
struct ContentView: View { | |
@State private var sourceType: UIImagePickerController.SourceType = .camera | |
@State private var selectedImage: UIImage? | |
@State private var isImagePickerDisplay = false | |
@State private var sync2 = speaking() | |
@State var strings:[String] = [] | |
var body: some View { | |
NavigationView { |
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
struct ImagePickerView: UIViewControllerRepresentable { | |
@Binding var selectedImage: UIImage? | |
@Environment(\.presentationMode) var isPresented | |
var sourceType: UIImagePickerController.SourceType | |
func makeUIViewController(context: Context) -> UIImagePickerController { | |
let imagePicker = UIImagePickerController() | |
imagePicker.sourceType = self.sourceType | |
imagePicker.delegate = context.coordinator |
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
class speaking: NSObject, AVSpeechSynthesizerDelegate { | |
var synth:AVSpeechSynthesizer! | |
override init() { | |
super.init() | |
synth = AVSpeechSynthesizer() | |
} | |
func speaker(words:[String]) { | |
for word in words { |