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
guard let results = request?.results, results.count > 0 else { | |
busyPerformingVisionRequest = false | |
return | |
} | |
... | |
/// ↓ Make the array of CGRects here ↓ | |
var rectangles = [CGRect]() | |
... |
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
} | |
... | |
/// We need to call placeHighlights on the main queue because it involves changing the UI | |
/// ↓ Add this ↓ | |
DispatchQueue.main.async { | |
self.placeHighlights(atTheseLocations: rectangles) | |
} | |
... |
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
/// This is how often we will get device motion updates | |
/// 0.03 is more than often enough and is about the rate that the video frame changes! | |
motionManager.deviceMotionUpdateInterval = 0.03 | |
motionManager.startDeviceMotionUpdates(to: .main) { | |
[weak self] (data, error) in | |
guard let data = data, error == nil else { | |
return | |
} |
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
//MARK: Motion (Accelerometer and Gyroscope) | |
/// motionManager will be what we'll use to get device motion | |
var motionManager = CMMotionManager() | |
/// this will be the "device’s true orientation in space" (Source: https://nshipster.com/cmdevicemotion/) | |
var initialAttitude: CMAttitude? | |
/// we'll later read these values to update the highlight's position | |
var motionX = Double(0) /// aka Roll |
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
// | |
// ** iCimulator.swift ** | |
// | |
// MIT License | |
// | |
// Copyright (c) 2019 YuigaWada | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy |
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 Alamofire | |
let heroku_token = "4d6e1611-9b1a-4bdd-948c-1ea25dfb4178" | |
func load_all_apps(completion: @escaping ([Any]) -> ()) { | |
var json_apps_list: [Any] = [] | |
print("APP") | |
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 scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { | |
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. | |
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene. | |
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). | |
guard let _ = (scene as? UIWindowScene) else { return } | |
/// ↓ ADD THIS ↓ | |
if let rootWindow = window { | |
let iPhoneXSize = CGSize(width: 375, height: 812) /// if you're running this on an iPhone X, delete this line... | |
//let iPhone8Size = CGSize(width: 375, height: 667) /// ...and uncomment this line |
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 application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { | |
// Override point for customization after application launch. | |
/// ↓ ADD THIS ↓ | |
if let rootWindow = window { | |
let iPhoneXSize = CGSize(width: 375, height: 812) /// if you're running this on an iPhone X, delete this line... | |
//let iPhone8Size = CGSize(width: 375, height: 667) /// ...and uncomment this line | |
Projector.display(rootWindow: rootWindow, testingSize: iPhoneXSize) | |
} |
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 Projector { | |
static func display(rootWindow: UIWindow, testingSize: CGSize) { | |
/// the size of the device that you're running your app on | |
let myDeviceSize = UIScreen.main.bounds.size | |
let myDeviceAspectRatio = myDeviceSize.width / myDeviceSize.height | |
let testingDeviceAspectRatio = testingSize.width / testingSize.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
enum DeviceType { | |
//MARK: - iPhones | |
/** | |
iPhone 5, iPhone 5S, iPhone 5C, iPhone SE 1st gen | |
*/ | |
case iPhoneSE1 | |
/** | |
iPhone 6, iPhone 6S, iPhone 7, iPhone 8, iPhone SE 2nd gen |