ALL BUSINESS
COMIDA
DIRECTORIES
EDUCATIONAL
ENTERTAINMENT
FASHION TIPS
FINER THINGS
FREE CREATOR TOOLS
HEALTH
MARKETPLACE
MEMBER's ONLY
MONEY MATTER$
MOTIVATIONAL
NEWS & WEATHER
TECHNOLOGIA
TELEVISION NETWORKS
USA VOTES 2024
VIDEOS
INVESTOR RELATIONS
IN DEVELOPMENT
Posted by - Latinos MediaSyndication -
on - March 25, 2023 -
Filed in - Technology -
-
355 Views - 0 Comments - 0 Likes - 0 Reviews
trying to learn to put my web dev skills to use in IOS. Not understanding how to add members to UIDragInteraction.
Seeing this error:
error build: Value of type 'UIDragInteraction' has no member 'previewForLifting'
My code:
import SwiftUI import WebKit class DragDelegate: NSObject, UIDragInteractionDelegate { func dragInteraction(_ interaction: UIDragInteraction, itemsForBeginning session: UIDragSession) -> [UIDragItem] { let webView = UIApplication.shared.windows.first?.rootViewController?.view.subviews.first(where: { $0 is WKWebView }) as? WKWebView let provider = NSItemProvider(object: webView?.url?.absoluteString as NSString? ?? "") let item = UIDragItem(itemProvider: provider) return [item] } } struct BPMNView: UIViewRepresentable { let urlString = "https://cdn.staticaly.com/gh/bpmn-io/bpmn-js-examples/dfceec6a/starter/diagram.bpmn" func makeUIView(context: Context) -> WKWebView { let webView = WKWebView() webView.load(URLRequest(url: URL(string: urlString)!)) return webView } func updateUIView(_ uiView: WKWebView, context: Context) { uiView.load(URLRequest(url: URL(string: urlString)!)) } } struct ContentView: View { var body: some View { VStack { Text("BPMN Diagram") .font(.largeTitle) .padding() BPMNView() .frame(minWidth: 0, maxWidth: .infinity, minHeight: 0, maxHeight: .infinity) .onAppear { if let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene, let view = windowScene.windows.first?.rootViewController?.view { let preview = UITargetedPreview(view: view) let interaction = UIDragInteraction(delegate: DragDelegate()) view.addInteraction(interaction) interaction.isEnabled = true interaction.previewForLifting = preview } } } } } struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView() } }
Im so new to this im not understanding the logic. I also cant get the screen to show the content when I take out interaction.previewForLifting = preview: