Post

Replies

Boosts

Views

Activity

Reply to NSPathControl in SwiftUI?
As far as i know In SwiftUI, there isn't a direct equivalent to NSPathControl from AppKit. However, you can use NSPathControl within a SwiftUI app by leveraging NSViewRepresentable, which allows you to integrate an AppKit view into a SwiftUI view hierarchy. Thanks Sairam Agireeshetti
Jul ’24
Reply to How to open Calendar app event's detail by its ID
To open the Apple Calendar app's event detail view programmatically, you can use the EventKit framework. In my investigation observed there isn't a direct URL scheme to open a specific event in the Calendar app. Instead, you can open the Calendar app and focus on the date of the event. let eventStore = EKEventStore() eventStore.requestAccess(to: .event) { (granted, error) in if granted { let event = eventStore.event(withIdentifier: "your_event_identifier") if let event = event { DispatchQueue.main.async { let eventViewController = EKEventViewController() eventViewController.event = event eventViewController.allowsEditing = true eventViewController.allowsCalendarPreview = true if let viewController = UIApplication.shared.keyWindow?.rootViewController { let navigationController = UINavigationController(rootViewController: eventViewController) viewController.present(navigationController, animated: true, completion: nil) } } } else { print("not found") } } else { print("denied") } } Make sure you have the correct event identifier. This identifier is unique for each event and can be retrieved when you create or list events. Remember to add the necessary keys to your app's Info.plist to request calendar access. username- Sairam Agireeshetti
Jul ’24
Reply to Load a URL (Excluding Header and Footer)
To exclude the header and footer of a website from displaying within a WKWebView, you can manipulate the loaded web content using JavaScript injection. Here's an example of how you can achieve this: import UIKit import WebKit class ViewController: UIViewController, WKNavigationDelegate { var webView: WKWebView! override func viewDidLoad() { super.viewDidLoad() webView = WKWebView(frame: view.bounds) webView.navigationDelegate = self view.addSubview(webView) let url = URL(string: "https://sairam.com") let request = URLRequest(url: url!) webView.load(request) } func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) { // Inject JavaScript to hide the header and footer let script = """ var header = document.querySelector("header"); // Replace "header" with the appropriate selector for your website's header var footer = document.querySelector("footer"); // Replace "footer" with the appropriate selector for your website's footer if (header) { header.style.display = "none"; } if (footer) { footer.style.display = "none"; } """ webView.evaluateJavaScript(script, completionHandler: nil) } } change it according to your code. Here, JavaScript is injected to hide the header and footer elements using the with appropriate CSS selector.Also identify the appropriate selectors for the header and footer elements you can inspect the web page's source code or use browser developer tools. username : Sairam Agireeshetti
Jul ’24
Reply to Scan multiple 1 D barcodes
I am also facing same issue, Is there any solution found to scan multiple 1-D barcodes results at once ? I found a way by using visionKit but it supports only from iOS 16 with Apple Neural Engine (ANE) supported devices(This solution not suitable for older devices with IOS 16 +).
May ’23