Post

Replies

Boosts

Views

Activity

Determining Landscape Left and Landscape Right?
I'm curious if anyone has discovered a way to determining if their Messages app is in landscape left or landscape right? I've seen this topic come up in other discussions, but have not seen a resolution. Since Messages Extensions do support use of the camera and AVFoundation, I've been unable to set my video orientation as I'd usually use UIDevice.current.orientation to determine the orientation. Messages Extensions consistently report an unknown orientation, rather than Face Up, Face Down, Portrait, Landscape Left, Landscape Right, etc.I've been able to use a helpful suggestion of someone here to determine portrait vs. landscape by checking the following in my viewDidLayoutSubviews();if UIScreen.main.bounds.size.width < UIScreen.main.bounds.size.height { // Portrait } else { // Landscape }This, however, results in things working well in portrait, but can result in rotated or upside down images in landscape since I cannot set landscape left or landscape right (or portrait upside down on iPad, for that matter).Thanks!
3
0
4.0k
Jun ’21
KeyboardShortcut Not Functioning in SwiftUI
While a bit new to keyboard shortcuts, I am looking to add a specific piece of functionality to my app. Specifically, I am wanting to allow my user to be able to trigger an action by pressing the spacebar, both on iPadOS, when using a keyboard, and macOS. This would function similarly to how video editing programs like iMovie and Final Cut Pro work. I have a "play" button in place, and am trying to add a modifier, like so; Button(action: { 	 self.isPlaying.toggle() }) { 	 Image(systemName: isPlaying ? "pause.fill" : "play.fill") }.keyboardShortcut(.space) .help("Play timeline") Based on the KeyboardShortcut documentation - https://developer.apple.com/documentation/swiftui/keyboardshortcut, this should be all I need to get things running. However, when building and testing my app, using the spacebar does not do anything (nor does the shortcut appear in the keyboard shortcuts list).
1
0
3.0k
Mar ’21
Dynamic Intent Selection not Generating Handling Class for Widget?
I am trying to build my first Widget, and am following the guidance in the Making a Configurable Widget - https://developer.apple.com/documentation/widgetkit/making-a-configurable-widget article. After confirming the default Widget runs successfully, I am trying to set up my Intent Definition and Intent Handler. I have taken the following steps; Created a new intent definition file, with the custom intent's category as View, eligibility for Widgets, and the parameter set to a custom type while selecting Options are provided dynamically. Created a new Intent Handler target, and set the Supported Intent's class name to something relevant, such as SelectCharacterIntent. The article implies that the newly created IntentHandler.swift file, which has an IntentHandler class, should be able to have that class extended to the intent definition file, as noted; Based on the custom intent definition file, Xcode generates a protocol, SelectCharacterIntentHandling, that the handler must conform to. Add this conformance to the declaration of the IntentHandler class. However, my project immediately reports that it Cannot find type 'SelectCharacterIntentHandling' in scope. I am unsure if I am doing something wrong, but it seems peculiar that the SelectCharacterIntentHandling protocol is created/implemented without me being aware. Surely, there must be a step to take to have that protocol created so I can extend my IntentHandler class to support my dynamic intent. Thank you!
5
0
4k
Mar ’21