I’ve tried implementing the accessibilityPerformMagicTap() method in a specific UIViewController, its view, and even in AppDelegate, but I am not receiving any callbacks.
I directly overrode this method in the mentioned areas, but it never gets triggered when performing a magic tap.
How can I properly observe and handle the accessibilityPerformMagicTap() action?
WWDC23
RSS for tagDiscuss the latest Apple technologies announced at WWDC23.
Posts under WWDC23 tag
21 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
I’m currently exploring VoiceOver accessibility in iOS and looking for the best way to reduce the number of swipes required to navigate a UITableView. I’ve come across a couple of potential solutions but am unsure which is preferred.
Solution 1: Grouping Subviews in Each Cell
Combine all subviews inside a UITableViewCell into a single accessibility element.
Provide a concise and meaningful accessibilityLabel.
Use custom actions (UIAccessibilityCustomAction) or accessibilityActivationPoint to handle interactions on specific elements within the cell.
Solution 2: Using UIAccessibilityContainerDataTableCell & UIAccessibilityContainerDataTable
Implement UIAccessibilityContainerDataTable for structured table navigation.
Make each cell conform to UIAccessibilityContainerDataTableCell, defining its row and column positions.
However, I’m finding this approach a bit complex, and I need guidance on properly implementing these protocols.
Additionally, in my case, VoiceOver is not navigating to Section 2—I’m not sure why.
Questions:
Which of these approaches is generally preferred for better VoiceOver navigation?
How do I properly implement UIAccessibilityContainerDataTable so that all sections and rows are navigable?
Any best practices or alternative recommendations?
Would really appreciate any insights or guidance!
I try to create a sheet that shows a textfield and the textfield should gain the focus immediately after the sheet is presented. This use case is explained in Session 10162 at 11:21 and at 13:31 my desired behavior is shown. I could not get this to work in my own code and downloaded the sample code from here:
https://developer.apple.com/documentation/swiftui/focus-cookbook-sample
Then I opened the sample code and run it in the simulator. It does not focus when the sheet appears in a iOS 18 simulator using Xcode 16 installed via the AppStore. It does gain focus if I use the "add" Button.
No changes made on the sample code. Just adjusted the Team setting to get a clean build. The behavior I get locally under iOS 18 is not what is shown in the session and I can't understand why.
I tried the following Simulators (and platforms) iPhone 16, iPad Pro (M4, 11inch) and my Mac. On none of those the last item got focus just by presenting the sheet.
Is it not possible to test this in a simulator? Could I have a configuration error? Given all the information I found yet, this seems like a Bug.
It would be very helpful if someone could replicate my problem. Thank you for your help.
Programm Versions:
Xcode: Version 16.0 (16A242d)
MacOS: 15.0 (24A335)
If I use the manual merge option with a mergeable library in debug mode, the app crashes on the device only.
Here's what I found when debugging this issue.
Problem situation 1
In the debug build, the linker does not find the type of the Meregeable Library.
Explain the debugged result of Problem Situation 1
We have a type called UserAdDTO, which belongs to the B Framework. - In our project, B Framework and C Framework are mergeable libraries, and they are merged into A Framework.
We are using Manual Merge in A Framework.
When we build with the simulator, we link the UserAdDTO from CFramework.framework/CFramework in the app target.
On the other hand, when I build with the device, I try to link it from AFramework.framework/AFramework, and I get the issue that UserAdDTO is not found.
So, even if you output DYLD_PRINT_BINDINGS, the simulator build links to the C Framework to find the UserAdDTO, but the app links to the B Framework, causing a runtime crash.
Problem situation 2
It is confirmed that only the device build does not copy the reexported binary.
Detailed description of problem situation 2
If you compare the build messages from the device build with the build messages from the release build, both generate the reexported binaries of B and C Frameworks, but do not copy them to BFramework.framework and CFramework.framework.
Instead, they copy the files in different paths.
This appears to be a bug, and I'd like to ask you to confirm.
When I configured the mergeable library manual and ran a build on the device, I got a runtime crash. However, when I build on the simulator, I don't get a runtime crash. This only happens when I build on the device. I was wondering if this is a bug?
The error message is shown in the attached picture.
Build environment
XCode 15.3
I built in debug mode.
The CoreToolKit target is manually merged with the rest of the targets.
The app target links to the CoreToolKit target.
The app target is not linked to the targets that are merged into the CoreToolKit target.
Current Apple ACME Profile does not support EAB. Do you have any plan to support it?
Hello,
I want to detect when a ScrollView is scrolled at the top of a specific View in a LazyVStack. Here is the code I use:
struct ContentView: View {
@State private var scrollID: Int?
var body: some View {
HStack {
VStack {
Text(scrollID?.formatted() ?? "Unknown")
Button("Go") {
withAnimation {
scrollID = 7
}
}
Divider()
ScrollView {
LazyVStack(spacing: 300) {
ForEach(0...100, id: \.self) { int in
Text(int.formatted())
.frame(maxWidth: .infinity)
.background(.red)
}
}
.scrollTargetLayout()
}
.scrollPosition(id: $scrollID, anchor: .top)
}
}
}
}
As I specify a top anchor, I was expecting to see the scrollID binding being updated when the red Text View is at the top of the ScrollView. But I noticed that scrollPosition updates the binding way before the red Text View is positioned at the top of the ScrollView, which is not what I want.
In this image, you can see the binding is already at one even though there is a lot of space between the View and the top of the ScrollView. Maybe the Stack spacing is taken into account?
And manually setting the binding scroll at the position I want, just above the red Text for 7, which makes me think the views IDs are correct.
Is my understanding wrong about this modifier?
How can I detect the top (beginning) of the View?
(If this is a SwiftUI bug, I filed #FB13811349)
I have a basic Widget with a button to toggle the home lights, the buttons triggers the following AppIntention:
import WidgetKit
import AppIntents
struct ConfigurationAppIntent: WidgetConfigurationIntent {
static var title: LocalizedStringResource = "Bulb state"
static var description = IntentDescription("This is an example widget.")
}
struct ToggleStateIntent: AppIntent {
static var title: LocalizedStringResource = "Toggle light state"
init(){
}
func perform() async throws -> some IntentResult {
await WizClient.shared.toggleState()
return .result()
}
}
The problem is that I must be running the app with xcode (in my phone, not simulator) to work fine, when I stop xcode the button must be pressed two times to trigger the AppIntention.
The toggle function works well on the app with a toggle component.
Here is the widget:
import WidgetKit
import SwiftUI
struct Provider: AppIntentTimelineProvider {
func placeholder(in context: Context) -> SimpleEntry {
SimpleEntry(date: Date(), configuration: ConfigurationAppIntent())
}
func snapshot(for configuration: ConfigurationAppIntent, in context: Context) async -> SimpleEntry {
SimpleEntry(date: Date(), configuration: configuration)
}
func timeline(for configuration: ConfigurationAppIntent, in context: Context) async -> Timeline<SimpleEntry> {
let timeline = Timeline(entries: [SimpleEntry(date: Date(), configuration: configuration)], policy: .atEnd)
return timeline
}
}
struct SimpleEntry: TimelineEntry {
let date: Date
let configuration: ConfigurationAppIntent
}
struct BulbActionsEntryView : View {
var entry: Provider.Entry
var body: some View {
HStack {
Button(intent: ToggleStateIntent()){
Text("Toggle")
}
}
.padding(.vertical)
}
}
struct BulbActions: Widget {
let kind: String = "BulbActions"
var body: some WidgetConfiguration {
AppIntentConfiguration(kind: kind, intent: ConfigurationAppIntent.self, provider: Provider()) { entry in
BulbActionsEntryView(entry: entry)
.containerBackground(.fill.tertiary, for: .widget)
}
}
}
extension ConfigurationAppIntent {
fileprivate static var test: ConfigurationAppIntent {
let intent = ConfigurationAppIntent()
print("Intent -> \(intent)")
return intent
}
}
#Preview(as: .systemSmall) {
BulbActions()
} timeline: {
SimpleEntry(date: .now, configuration: .test)
}
I have spent hours trying to get @Query macros to compile. Mostly they throw up meaningless errors for example the following produces 3 compiler errors:
@Query var stylesheets: [StyleSheet]
Here's the expansion.
The compiler complains that 'private' can't be used here, and it can't find _stylesheets. I searched everywhere to find a resolution then I came across the Query struct. I used it as follows to replace the @Query:
let query = Query(FetchDescriptor<StyleSheet>(), animation: .smooth)
let styleSheets = query.wrappedValue
This also solves another issue that was bugging me - how to get the context when the environment variable is often rejected. All I need to do now is write:
let context = query.modelContext
None of the WWDC23 SwiftData videos mentions the use of the struct, which is a shame. It feels much like the CoreData approach to fetching data.
I hope this helps some of you.
I am exploring Appi-Intent and Appshortcut. We can create an action shortcut by using the following code.
struct WatchListShortcut: AppShortcutsProvider {
static var appShortcuts: [AppShortcut] {
AppShortcut(
intent: WatchListAppIntent(),
phrases: [
"Tell \(.applicationName) to open first item in watch list",
],
shortTitle: "WatchList item",
systemImageName: "systemimage"
)
}
}
What I want to show an entity shortcut like shown in the below screenshot.
linkText
I am not sure how to create the shortcut like Assigned one in the above screen.
I have tried the codes in this page
https://developer.apple.com/forums/thread/731271?answerId=755458022#755458022
.scrollPosition(id: $dataID) is supposed to keep the current ScrollView position.
However, none of them work.
I use Xcode 15.3. Tested on iOS 17.0.1 and iOS 17.4 simulators.
The people in the page talk like it works for appending, not for prepending.
But in my tests, none of them keeps the scroll position.
The scroll view will scroll to other part, without changing the dataID.
It will update the dataId to the current value only when I scroll manually.
It's not possible to merge a framework with resource into an iOS app target because the resource are not included in the app bundle.
Steps to reproduce:
Create an Xcode Project with iOS App Template
Add a Framework Target (make sure to "Embed in Application")
Add an Asset Catalog to Framework Target
Add an Color Resource (or Image Set, or any other Resource)
Reference the Resource in App Target (I have used a SwiftUI View)
Run on Device (!) to make sure everything works as expected
Change "Create Merged Binary (MERGED_BINARY_TYPE)" build setting of app target to "Automatic (automatic)"
Change app target settings to link, but not embed framework target (e.g. change from "Embed and Sign" to "Do Not Embed" in "Frameworks, Libraries and Embedded Content" section in "General" tab)
Run again (on Device!) and observe how the resources framework resource cannot be found anymore (using SwiftUI you will see a "No image/color named '...' in asset catalog for ..." error message in console logs)
Note:
Everything works fine in Simulator
Same behavior for Release and Debug configuration
Same behavior for manual and automatic merging
Same behavior for resources which are not bundled in Asset Catalog
When archiving the app, an "Assets.car" file is never present (even when creating archiving for Simulator target, when "Allow archiving for Simulator" is enabled)
Reported as FB13716505
Test Project: https://github.com/iteracticman/MergeableResources/
I have a question. When the DDM status report is sent from a DDM device, normally an empty response is returned. However, if we return a non-empty response that includes an arbitrary string, the device sends us the declaration-items request. Is this behavior correct?
device| --status reort--------> |server
device| <------a non-empry----- |server
device| --declaration-items---> |server. Is this behavior correct?
I am trying to find how to configure an application when using an AppManaged declaration. Using MDM, I would send the install command and include the settings in the 'Configuration' key of the command. I have checked the documentation and rewatched the 2023 WWDC video, but it is not mentioned at all.
AppManagedAttributesObject has specific configuration options and doesn't appear to cater for adhoc app specific configurations.
Anyone found a way to accomplish this? There are a number of apps (store and enterprise) that require this functionality in order to be configured remotely.
Near the bottom,
Describing data use in privacy manifests, says:
App extensions don’t include privacy information files. The operating system and App Store Connect use the privacy information file in the extension’s host app bundle, in combination with those from third-party SDKs your app links to.
Yet the warnings email we see lists the app's extensions as missing manifests.
Are we reading the documentation incorrectly?
Getting this clarified helps us justify approvals for the additional work.
i have a code only static library framework and added PrivacyInfo.xcprivacy file inside.
because there are no resources required in runtime,
app using that framework can build without embedding.
finally there are no PrivacyInfo.xcprivacy file in app bundle.
is this correct intended operation?
some steps to propagate and merge static framework's privacy manifest to app's privacy manifest not needed?
My app is using SwiftData, but I deployed it to the app store with no VersionedSchema applied without thinking about migrating the model. Now I need to migrate the data and I need help from someone who has experience moving from non-versioned to versioned.
Assuming I currently have a version1, version2 schema, it works fine for the initial install situation, but when I migrate to version1, version2 in an app that is listed on the app store, I run into problems.
I don't have any logs to show for it. Thread 1: EXC_BAD_ACCESS (code=2, address=0x16a6578f0) If anyone has had the same experience as above, please respond, thanks!
Let me know what kind of logs you need and I'll add them as a comment.
I'm currently using Swiftdata to store data for an app I've deployed to the app store.
The problem is that the app does not build when I add a case of the Enum type to the model, so I decided to apply a MigrationPlan. I also decided that it is not a good idea to store the Enum type itself because of future side effects.
The app is deployed in the app store with a model without a VersionedSchema, so the implementation is complete until we modify it to a model with a VersionedSchema.
This is Version1.
public enum TeamSchemaV1: VersionedSchema {
public static var versionIdentifier: Schema.Version = .init(1, 0, 0)
public static var models: [any PersistentModel.Type] {
[TeamSchemaV1.Team.self,
TeamSchemaV1.Lineup.self,
TeamSchemaV1.Player.self,
TeamSchemaV1.Human.self]
}
@Model
public final class Lineup {
...
public var uniform: Uniform
...
}
And you're having trouble migrating to Version2. The change is to rename the Uniform to DeprecatedUniform (the reason for the following change is to migrate even if it's just a property name)
public enum TeamSchemaV2: VersionedSchema {
public static var versionIdentifier: Schema.Version = .init(1, 0, 1)
public static var models: [any PersistentModel.Type] {
[TeamSchemaV2.Team.self,
TeamSchemaV2.Lineup.self,
TeamSchemaV2.Player.self,
TeamSchemaV2.Human.self]
}
@Model
public final class Lineup {
...
@Attribute(originalName: "uniform")
public var deprecatedUniform: Uniform
...
When you apply this plan and build the app, EXC_BAD_ACCESS occurs.
public enum TeamMigrationPlan: SchemaMigrationPlan {
public static var schemas: [VersionedSchema.Type] {
[TeamSchemaV1.self, TeamSchemaV2.self]
}
public static var stages: [MigrationStage] {
[migrateV1toV2]
}
public static let migrateV1toV2 = MigrationStage.lightweight(fromVersion: TeamSchemaV1.self,
toVersion: TeamSchemaV2.self)
}
I'm currently unable to migrate the data, which is preventing me from updating and promoting the app. If anyone knows of this issue, I would really appreciate your help.
I am trying to implement a third party passkey credential provider and I have been able to successfully setup the project for that. Below is a sample code which I am using -
let passkeyRegistrationCredential = ASPasskeyRegistrationCredential(relyingParty: self.request?.credentialIdentity.serviceIdentifier.identifier ?? "", clientDataHash: self.request?.clientDataHash ?? Data(), credentialID: Data(credentialId), attestationObject: Data(attestationBytes)
self.extensionContext.completeRegistrationRequest(using: passkeyRegistrationCredential)
The attestationBytes object that I am generating and sending back to RP seems to work only if I set the "fmt" to "none", which basically requires "attStmt" to be sent as an empty value as per WebAuthn spec - https://www.w3.org/TR/webauthn-2/#sctn-none-attestation
When trying to set the "fmt" to "packed" in attestation object and creating a self signed "attStmt" consisting of "alg" and "sig" key-values referring - https://www.w3.org/TR/webauthn-2/#sctn-packed-attestation, it does not seem to work. The RP throws an error. I do not have "x5c" object as that supposedly is not mandatory in case of self attestation. I have "authData" also as part of the response properly setup.
Is it not possible to use packed attestation or am I missing something in creating the attestation object? Also, does Apple modify the response being sent in the background before sending to RP if packed fmt is used?
Topic:
App & System Services
SubTopic:
Core OS
Tags:
Authentication Services
Passkeys in iCloud Keychain
WWDC23
I have an iOS app target with a framework dependency and want to merge that framework by setting MERGED_BINARY_TYPE to automatic in the app target's build settings.
It all works fine until I add a (non-private) UIHostingController to the framework target. When I do this it crashes on startup with this message: dyld[15894]: Symbol not found: _OBJC_CLASS_$__TtC5Frame4MyVC.
Xcode 15.1b3
Reported as bug via Feedback Assistant: FB13379276