Open Xcode and create a new Single View App using the shortcut ⇧⌘N. For Product Name type in MeasureSwing, select Storyboard for the User Interface, and click Next. In the next window, select a location on your Mac for the project and click Create.
Next let’s add our logging library to the project. Select the menu item File > Swift Packages > Add Package Dependency, type https://github.com/dasdom/LogStore2.git into the search field, and press return. Click Next and then Finish. To activate the logging library, add the highlighted lines in the following code to SceneDelegate:
| import UIKit |
» | import LogStore |
| |
| class SceneDelegate: UIResponder, UIWindowSceneDelegate { |
| |
| var window: UIWindow? |
» | var trigger: LogTrigger? |
| |
| func scene(_ scene: UIScene, |
| willConnectTo session: UISceneSession, |
| options connectionOptions: UIScene.ConnectionOptions) { |
| |
| guard let _ = (scene as? UIWindowScene) else { return } |
| |
» | #if DEBUG |
» | trigger = LogTrigger(in: window) |
» | #endif |
| } |
| |
| // ... |
| // other methods |
| // ... |
| } |