Post

Replies

Boosts

Views

Activity

Problems with draggable and dropDestination using DataRepresentation in Transferable
I can't get my drag and drop with DataRepresentation to work with Transferable. I'm trying to drag and drop instances of DataSettings which is an NSManagedObject that conforms to NSSecureCoding. Here's my UTType: extension UTType { static var encoderSettings = UTType(exportedAs: "com.simulator.EncoderSettings") } Here's my conformance to Transferable: extension DataSettings: Transferable { var data: Data? { try? NSKeyedArchiver.archivedData(withRootObject: self, requiringSecureCoding: true) } public static var transferRepresentation: some TransferRepresentation { /*DataRepresentation(contentType: .commaSeparatedText) { setting in let data = setting.data print("DataRepresentation: \(data)") return data! } importing: { data in print("data: \(data)") return DataSettings() }*/ DataRepresentation(contentType: .encoderSettings) { setting in let data = setting.data print("DataRepresentation: \(data)") return data! } importing: { data in print("data: \(data)") return DataSettings() } // ProxyRepresentation(exporting: \.title) } } Here's a view where I'm testing my drop destination: struct DropTest: View { @State var isDropTargeted = false var body: some View { Color.pink .frame(width: 200, height: 200) .dropDestination(for: EncoderSettings.self) { setting, location in print("\(setting)") return true } isTargeted: { isDropTargeted = $0 print("Got it!!!") } } } Here's my Info plist: The ProxyRepresentation (String) works but I need the actual Data. The dragging starts (i.e.: I can drag the view that has the .draggable with DataSettings) but I can't drop it on my DropTest view. I can drop it on a view or app that accepts the ProxyRepresentation. What am I missing?
2
0
1.1k
Feb ’23
Disappearing AppIntents
My AppIntents were showing in the Shortcuts app. Now they don't. If I try to create a shortcut my app doesn't show in the list of apps that have shortcuts. I have no compile or linking errors. I'm using Xcode 14.1. My app is UIKit based though it has lots of SwiftUI. Any ideas on how to resolve this would be greatly appreciated.
3
0
1.3k
Nov ’22
Keyboard shortcuts for standard iPadOS 15 keyboard shortcuts
My iPad app supports features such Copy (cmd-C) and Paste (cmd-V). How can I get these to show in the Edit menu when I hold down the Command key? Undo (cmd-Z) and Redo (shift-cmd-Z) show perfectly. Looks like the system internally looks at UndoManager. Same with Hide Sidebar: system detected presence of Sidebar and is showing the keyboard shortcut to hide it. Ramon.
1
0
1.1k
Jan ’22
Xcode Error trying to subclass UIContextMenuConfiguration
I'm getting Xcode compiler error when trying to subclass UIContextMenuConfiguration. Here's simple code that reproduces the problem: @available(iOS 13.0, *) class DateDifferenceContextMenu: UIContextMenuConfiguration { 		init(indexPath: IndexPath, dateDifference: Int) { 				super.init(identifier: nil, previewProvider: nil, actionProvider: nil) 		} } The error reads: Must call a designated initializer of the superclass 'UIContextMenuConfiguration'. My super call matches the designated initializer. What's wrong?
1
0
799
Sep ’20
NSUserActivity missing userInfo for a newly requested scene
I'm creating a new scene like: UIApplication.shared.requestSceneSessionActivation(nil, userActivity: activity, options: nil/*options*/) { error in       dPrint("\(error)")     } The activity parameter has userInfo that I need in the new scene; for example,     activity.userInfo = ["sampleKey":"sampleData"] Here's how I'm creating the new scene:   func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {         guard let windowScene = scene as? UIWindowScene else { return }     window = UIWindow(windowScene: windowScene)     window?.rootViewController = ContainerViewController(to: createSplitViewController())     window?.makeKeyAndVisible()     scene.title = SystemData.appName     if appDelegate.isOnboardingNeeded, let containerController = window?.rootViewController as? ContainerViewController {       appDelegate.launchOnboardingIfNeeded(with: containerController)     }     if let activity = connectionOptions.userActivities.first ?? session.stateRestorationActivity {       dPrint("\(#function) \(activity)")       masterViewController?.restore(from: activity, isStandalone: false, persistentId: scene.session.persistentIdentifier)     }   } The print statement has an empty userInfo. What's the problem?
Topic: UI Frameworks SubTopic: UIKit Tags:
3
0
1.5k
Jun ’20