Post

Replies

Boosts

Views

Activity

How can we make elements which are grouped accessible for automation
I have a stackview which have 2 labels class TextView: UIView { @IBOutlet private weak var stackView: UIStackView! { didSet { stackView.isAccessibilityElement = true stackView.accessibilityLabel = label1.text + label2.text } } @IBOutlet private weak var label1: UILabel! { didSet { label1.accessibilityIdentifier = "label1" } } @IBOutlet private weak var: UILabel!{ didSet { label2.accessibilityIdentifier = "label2" } } } My goal here is to have a combines accessibility label for the stackview and yet able to access the accessibilityIdentifier of child elements for automation.
0
0
821
2w
Can we see Accessibility Identifiers alone of automation elements in swift which are not accessibility Elements
I want to expose few elements for accessibility alone and other for automation alone. But I can only accessibility elements in Accessibility Inspector but can't see Automation Elements self.view.accessibilityElements = [loginButton as Any, registerButton as Any, closeButton as Any] self.view.automationElements = [claimLabel as Any, loginButton as Any, registerButton as Any, intoductionImage as Any, closeButton as Any])
1
0
337
3w
How to to expose elements for automation but not for accessibility in swift UIKit?
I have two views in a container view as below @IBOutlet weak var dataDisclosureView: UIStackView! // Main ContainerView @IBOutlet private weak var titleLabel: UILabel! { didSet { titleLabel.text = "Hello" } } @IBOutlet private weak var descriptionLabel: UILabel! { didSet { descriptionLabel.text = "World" } } @IBOutlet weak var descriptionView: UIStackView! { // sub container view containing titleLabel and descriptionLabel didSet { descriptionView.isAccessibilityElement = true descriptionView.accessibilityLabel = "Hello" descriptionView.accessibilityIdentifier = "test_hello" } } @IBOutlet private weak var requestButton: UIButton! { didSet { requestButton.isAccessibilityElement = true requestButton.accessibilityLabel = "Request Button" requestButton.accessibilityIdentifier = "test_button" } } override func viewDidLoad() { super.viewDidLoad() dataDisclosureView.isAccessibilityElement = false dataDisclosureView.accessibilityElements = [ descriptionView ?? "" ] if #available(iOS 17.0, *) { dataDisclosureView.automationElements = [ descriptionView ?? "", requestButton ?? ""] } else { // Fallback on earlier versions } let requestButtonAction = UIAccessibilityCustomAction(name: "start", target: self, selector: #selector( request)) dataDisclosureView.accessibilityCustomActions = [ requestButtonAction ] } Mx issue is I want AccessibilityIdentifers for descriptionLabel,titleLabel,requestButton and hintLabel(For Automation) and accessibility labels for descriptionView and requestButton(VoiceOver Accessibility). But I am unable to see accessibilityIdentifier for Button, TitleLabel and descriptionLabel in AccessibilityInspector. what am I doing wrong here?
1
0
263
3w
How to combine child views and expose containerView for accessibility and at the same time child views for Automation?
I have an image and label inside UIStackView which are inside a viewcontroller. I want to make my UIView accessible. So I wrote below code: var image: UIImage! var myView: UIStackView! var label : UILabel! myView.isAccessibilityElement = true myView.accessibilityLabel = "Hello" myView.accessiblityIdentifier = "test_view" image.accessiblityIdentifier = "test_image" label.accessibilityIdentifier = "test_label" All are UIKit Elements. How to expose mvView to accessibility and only children to automation I tried below two ways, none of them worked: self.view.accessibilityElements = [myView] myView.accessibilityElements = [] from apple documentation : If the object is a view and it’s an accessibility element, and accessibilityElements is empty, the system assigns the list of subviews that have an accessibilityIdentifier to automationElements. myView.automationElements = [myView,image,label] from apple documentation : In some cases, you might want to expose elements for automation but not for accessibility, or vice versa. In a view containing an image with a label under it, for example, you might choose to expose only the label for accessibility. For automation, however, you might include both the image and the label in a test to confirm the both objects exist. In this case, add both the image and the label to automationElements. I am really going crazy with this since many days. Help is very much appreciated.
0
0
201
3w
How can we add multiple apps under webcredentials in Associated domain file
I want to add my testing app and prod app for release in associated domain file. How can I add them in apple-app-site-association. Can I add both separated by coma { "webcredentials": { "apps": [ "3ABCDEF.com.lalitha.release" , 3ABCDEF.com.lalitha.test] } } In Apple documentation example they haven't mention about adding multiple apps under web credentials [https://developer.apple.com/documentation/xcode/supporting-associated-domains]
1
0
566
Jun ’24
Authorization by AEDeterminePermissionToAutomateTarget waits infinit time
I use this method to check Apple Event (Automation) permission: bool checkAuth (string : appId) { OSStatus status = noErr; if (@available(macOS 10.14, *)) { NSAppleEventDescriptor *targetAppEventDescriptor; targetAppEventDescriptor = [NSAppleEventDescriptor descriptorWithBundleIdentifier:appId.toNSString()]; status = AEDeterminePermissionToAutomateTarget(targetAppEventDescriptor.aeDesc, typeWildCard, typeWildCard, true); }return status == noErr; } The problem is that the execution freezes once in 100 times at API: AEDeterminePermissionToAutomateTarget and the user is not prompted for authorization. usage example:  checkSIPforAppIdentifier("com.microsoft.Word"); I have inserted necessary key in info.plist: <key>NSAppleEventsUsageDescription</key> <string>*** uses this feature to do do Typography actions.</string> My App is not sandboxed. PS: this issue is not consistently reproducible , once I restart the machine it works
15
0
4.2k
Nov ’20
How to print a non PDF document from MacOS using swift or shell script
Is there any framework in macOS to print a non pdf document. PDF kit is showing print panel that too only for PDF documents.Code snippet : let pdfView = PDFView() let path = URL(fileURLWithPath: "/Users/syamala/Desktop/Book1.pdf") let pdfDoc = PDFDocument(url: path) pdfView.document = pdfDoc let wnd = NSWindow() pdfView.autoScales = true pdfView.displaysPageBreaks = false wnd.setContentSize(pdfView.frame.size) wnd.contentView = pdfView pdfView.print(with: NSPrintInfo.shared, autoRotate: true)Shell command lp /Users/syamala/Desktop/Book1.pdf , even this prints only pdf docs but not non-pdf docs.Is there any swift native framework to print a document from local directory or shell command to print a document.
0
0
853
Mar ’20
Which is the best way to repeat a code every 12 hours in swift for Mac OSX application
Below are the two ways i am doing it, but wanted to know which is best way to do it and whyFirst wayTimer.scheduledTimer(withTimeInterval: 43200, repeats: true) { timer in let randomNumber = Int.random(in: 1...20) print("Number: \(randomNumber)") if randomNumber == 20 { timer.invalidate() } }second waylet date = Date().addingTimeInterval(43200) let timer = Timer(fireAt: date, interval: 0, target: self, selector: #selector(runCode), userInfo: nil, repeats: false) RunLoop.main.add(timer, forMode: .common) @objc func runCode() { print("Running code after every 5 seconds") }
5
0
1k
Feb ’20
How to open multiple windows one by one using a loop in OSX?
I can open multiple windows using a loop. Now I want to open these windows one by one. That means when I close one window the next window will be opened, I mean till the close of the first window next window should not be opened. Using below code all windows are getting opened at a time.let selectedFiles = ["file1","file2"] for eachfile in selectedFiles { let storyBoard : NSStoryboard = NSStoryboard(name: "Main", bundle:nil) let newViewController = storyBoard.instantiateController(withIdentifier: "MainView") as? ViewController if newViewController != nil { newViewController.ParentView = self self.presentAsModalWindow(newViewController!) } }I want the second window to open only after closing first window
5
0
1.1k
Jan ’20