Adding Our Logging Library

Select the Xcode menu item File > Swift Packages > Add Package Dependency and paste in the URL of your package from one of the supported hosting services. If you didn’t post your package to one of the services, you can use mine.[8] Add the package as you did in the previous chapters.

Previously we had to set up the trigger window in the SceneDelegate of the project. Augmented reality apps don’t have a scene delegate, so instead we’ll add the trigger to the AppDelegate. Open AppDelegate.swift and add the highlighted lines in the following code:

 import​ ​UIKit
»import​ ​LogStore
 
 @UIApplicationMain
 class​ ​AppDelegate​: ​UIResponder​, ​UIApplicationDelegate​ {
 
 var​ window: ​UIWindow​?
»var​ trigger: ​LogTrigger​?
 
 func​ ​application​(
  _ application: ​UIApplication​,
  didFinishLaunchingWithOptions launchOptions:
  [​UIApplication​.​LaunchOptionsKey​: ​Any​]?) -> ​Bool​ {
 
»#if DEBUG
» trigger = ​LogTrigger​(in: window)
»#endif
 
 return​ ​true
  }
 
 // ...
 // other methods
 // ...
 }

This code should be quite familiar to you now. As a refresher, this code defines and sets up an instance of LogTrigger when we build the app in the debug configuration. The log trigger allows the user to perform a special gesture with the iPhone to show the log in the running app without using Xcode.

Now we’ll move on to the screen that shows the distance to the text location.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.143.9.115