Post

Replies

Boosts

Views

Activity

Is it impossible to include an URL of a file in iCloud Drive in NSUserActivity#userInfo?
Hi. I want to create a new UIScene when my app opens a file in some condition. So I wrote requestSceneSessionActivation in scene(_:openURLContexts:).     func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {     &#9;&#9;let options = UIScene.ActivationRequestOptions()     &#9;&#9;options.requestingScene = scene     &#9; UIApplication.shared.requestSceneSessionActivation(nil, userActivity: createUserActivity(for: url), options: options) { error in       &#9;&#9;&#9;print(debug: error)     &#9;&#9;}   &#9;}     private func createUserActivity(for url: URL) -> NSUserActivity {     &#9;&#9;let userActivity = NSUserActivity(activityType: getUserActivityType(idx: 1)!)     &#9;&#9;userActivity.requiredUserInfoKeys = ["url"]     &#9;&#9;userActivity.addUserInfoEntries(from: ["url": url])     &#9;&#9;(UIApplication.shared.delegate as? AppDelegate)?.url = url &#9;&#9;    return userActivity &#9;&#9;} But scene(_:willConnectTo:options:) gets an empty userInfo. Is it impossible to include an URL of a file in iCloud Drive in NSUserActivity#userInfo? I guess that it is not because it is a Security-Scoped URL. Is my understanding right? And if so, how can I pass a Security-Scoped URL to a scene to be created? Of course, If you make a property for it in your AppDelegate, you can do it but I think that it is not normal. Thank you in advance,
Topic: UI Frameworks SubTopic: UIKit Tags:
0
0
811
Dec ’20
Could someone summarize Catalyst and M1 Mac relationship?
Hi. When Catalyst was released, I understood that it consisted of two factors, compiling for Intel CPU and UIKit on macOS. So you needs to add target "Mac" and Mac.entitlements on Xcode to run your app on Catalyst. Now M1 Mac appears and it runs iPhone/iPad apps without the above compilation if they are distributed. In this case, still do iPhone/iPad apps run on Catalyst? (I mean that macOS-specific features such as UIHoverGestureRecognizer work on M1 Mac if you implement some using these features.) 2. Why don't you need Mac.entitlements? The above two questions are just what I come up with. Detail summary is welcome. Thanks
0
0
701
Jan ’21
Is cleaning up StoreObserver in applicationWillTerminate method enough?
Hi. In the sample code "Offering, Completing, and Restoring In-App Purchases "(https://developer.apple.com/documentation/storekit/in-app_purchase/offering_completing_and_restoring_in-app_purchases), there is a cleanup code in applicationWillTerminate method.func applicationWillTerminate(_ application: UIApplication) { // Remove the observer. SKPaymentQueue.default().remove(StoreObserver.shared) } But applicationWillTerminate method is not called when the app is suspended according to the document (https://developer.apple.com/documentation/uikit/uiapplicationdelegate/1623111-applicationwillterminate). What would happen about StoreObserver.shared if the suspended app is terminated? Thanks.
0
0
701
Jan ’21
How does UIScene know whether it has the main key window and when it changes on iPad's multi-scene?
Hi. I know to know which window gets hardware keyboard events (such as shortcut key) currently on iPad. Until iPadOS 15.0, UIApplication.shared.keyWindow, which was deprecated on iPadOS 13.0 and didBecomeKeyNotification/didResignKeyNotification. But after iPadOS 15.0, a keyWindow is managed by UIScene, not by UIApplication. Each scene of my app always has just one window. For my purpose, checking deprecated UIApplication.shared.keyWindow is still effective but didBecomeKeyNotification and didResignKeyNotification don't work because they are fired when a change happens only inside the scene. So my questions are, What is the new alternative of UIApplication.shared.keyWindow? I know a wrong hack like UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene }.first?.windows.filter { $0.isKeyWindow }.first does not work since the order of connectedScenes is not related with getting hardware keyboard events. What are the new alternatives of didBecomeKeyNotification/didResignKeyNotification which work on inter-scene? The second question is more crucial. Because about the first question, I can still use deprecated UIApplication.shared.keyWindow. Thanks.
Topic: UI Frameworks SubTopic: General Tags:
0
0
239
Feb ’25
How can I run MPSGraph with float16?
Hi. I am implementing some neural network model by MPSGraph on Radeon Mac. I want to accelerate it by float16 since Radeon can execute kernels with float16 twice faster than float32. Is it possible? I mean, does MPSGraph support native float16 on Radeon GPU? If so, how can I do it? Setting all datatypes to float16? Thanks.
1
0
989
Oct ’21
How can I implement a template selection via creating a new document using DocumentGroup?
Hi. I want to implement a template selection such as Pages and Numbers. Currently I am using DocumentGroup scene on SwiftUI. How can I implement it? init( newDocument: @autoclosure @escaping () -> Document, @ViewBuilder editor: @escaping (FileDocumentConfiguration<Document>) -> Content ) The initializer of DocumentGroup may suggest that the newDocument argument should open template selector and return one when the selector is closed. But I think that it may beome a complicated implementation. What is a right way to implement the template selector?
1
0
570
Aug ’23
How do we use the computational power of A17 Pro Neural Engine?
Hi. A17 Pro Neural Engine has 35 TOPS computational power. But many third-party benchmarks and articles suggest that it has a little more power than A16 Bionic. Some references are, Geekbench ML Core ML performance benchmark, 2023 edition How do we use the maximum power of A17 Pro Neural Engine? For example, I guess that logical devices of ANE on A17 Pro may be two, not one, so we may need to instantiate two Core ML models simultaneously for the purpose. Please let me know any technical hints.
1
0
2.7k
May ’24
Can I make my own “live listen” app?
Hi.I tried to use "live listen" by my beats headset but failed. It seems that "live listen" feature is enabled only for AirPods (Pro) or "made for iPhone" hearing aids.And I also tried to switch an input device to builtInMic by setPreferredInput on Swift Playgrounds.It succeeded but it also switches the output to built in speaker.Since I want to keep the output to the headset, I failed to make my own "live listen".Is "live listen" setting an private API?Or is it possible to make my own "live listen" app if I have AirPods?Thanks.
3
0
1.4k
Feb ’21