Post

Replies

Boosts

Views

Activity

How do I dismiss the DatePicker popup in UI tests that are running on iOS 16 devices?
I have defined a DatePicker to have the compact style, as follows: struct ContentView: View { @State private var selectedDate = Date() var body: some View { DatePicker("Date Selected", selection: $selectedDate, displayedComponents: [.date]) .accessibilityIdentifier("DatePicker") .datePickerStyle(.compact) } } I have defined a UI test that taps on the DatePicker to show the DatePicker popup, then taps on one of the dates in the DatePicker popup to select that date, and then taps on the DatePicker again to dismiss the DatePicker popup, as follows: func test_date_picker() { let application = XCUIApplication() // 0. Launch the app application.launch() // 1. Show the DatePicker popup application.datePickers["DatePicker"].tap() // 2. Change the selected date application.datePickers.collectionViews.buttons["Friday, November 25"].tap() // 3. Dismiss the DatePicker popup application.datePickers["DatePicker"].tap() } This test works on iOS 14 and iOS 15 devices. Sadly, the final application.datePickers["DatePicker"].tap() call is failing on iOS 16 devices because application.datePickers["DatePicker"] is not hittable. How do I dismiss the DatePicker popup on iOS 16 devices? For what it's worth, I'm running the test via Xcode 14.1 on iOS 16.1 simulator devices. I do not have a real iOS 16 device to hand so I cannot verify the behaviour on a real iOS 16 device. Lastly, you can find a minimal application project that demonstrates the problem here.
1
0
2.1k
Nov ’22
Can a UIView object combine the accessibility properties of its children automatically?
I have a view hierarchy as follows: UIView \-- UIStackView +-- UILabel \-- UILabel By default, VoiceOver skips over the UIView and stops on each of the UILabels separately. I would like VoiceOver to stop on the UIView and combine its contents (i.e. read the accessibility label of each of its accessible children one by one). Does UIKit offer an API to achieve this similar to SwiftUI's accessibilityElement(children: .combine) API? Notes I know I can set isAccessibilityElement to true on the UIView and then set its accessibilityLabel to "\(label1.text!) \(label2.text!)". I'm wondering whether there is an automatic means of achieving this which doesn't require me to define the UIView's accessibilityLabel. The problem with having to define the UIView's accessibilityLabel manually based on its children is that I have to remember to change the UIView's accessibilityLabel in every place where the text or accessibilityLabel of any of its children changes.
2
1
1.4k
Jan ’23
Is it possible to build a dynamic framework without the symbols of a static library that it links to?
I have an app that links to two dynamic frameworks which both link to the same static library, as follows: |--App |--DynamicFramework1 |--StaticLibrary |--DynamicFramework2 |--StaticLibrary <- the same library that DynamicFramework1 links to The static library's symbols are included in each framework's binary because of the way dynamic frameworks are built by default. The app therefore finds duplicates of the static library's symbols at runtime. Is it possible to link a dynamic framework to a static library (and to still be able to call on the classes and methods of the static library within the dynamic framework) in a manner that symbols from the static library are excluded from the dynamic framework's binary? My hope in doing this is that the binary of each of the two dynamic frameworks will exclude the symbols of the static library. I will then make it the responsibility of the app to link to the static library directly. Notes I have tried linking my dynamic framework with the static library in two different ways thus far: (1) I added the static library to my framework's "Link Binary with Libraries" Build Phase; and (2) I referenced the static library in my framework's "Other Linker Flags" Build Setting. Both result in the static library's symbols being included in the framework's binary. I am aware that changing a framework target's "Mach-O Type" from "Dynamic Framework" to "Static Library" will build the framework's binary without the symbols of the static libraries that it links to. I want to keep my frameworks as dynamic frameworks so that (1) I can benefit from how Xcode bundles together resources (strings, storyboards etc) automatically for dynamic frameworks; and (2) users of my framework can benefit from Mergeable Libraries in the near future. I am aware that I can solve this problem by changing the static library to a dynamic framework. I want to avoid this as much as possible since the static library is from a third-party. I want to avoid forking the static library's source code and messing with its build scripts if I can.
4
1
1.9k
Nov ’23