Skip to content

Commit 842f6f2

Browse files
authored
Improve Proxies ergonomics (#31)
1 parent 41f388d commit 842f6f2

22 files changed

Lines changed: 2101 additions & 1366 deletions

File tree

DependenciesAdditions.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Sources/AccessibilityDependency/AccessibilityDependency_iOS.swift

Lines changed: 27 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -289,45 +289,41 @@
289289
UIAccessibility.shouldDifferentiateWithoutColor
290290
},
291291
configureForGuidedAccess:
292-
.init {
293-
{ features, enabled in
294-
try await withUnsafeThrowingContinuation { continuation in
295-
UIAccessibility.configureForGuidedAccess(features: features, enabled: enabled) {
296-
enabled, error in
297-
if let error {
298-
continuation.resume(with: .failure(error))
299-
} else {
300-
continuation.resume(with: .success(enabled))
301-
}
292+
.init { features, enabled in
293+
try await withUnsafeThrowingContinuation { continuation in
294+
UIAccessibility.configureForGuidedAccess(features: features, enabled: enabled) {
295+
enabled, error in
296+
if let error {
297+
continuation.resume(with: .failure(error))
298+
} else {
299+
continuation.resume(with: .success(enabled))
302300
}
303301
}
304302
}
305303
},
306304
convertToScreenCoordinatesUsingUIBezierPath:
307-
.init { { UIAccessibility.convertToScreenCoordinates($0, in: $1) } },
305+
.init { UIAccessibility.convertToScreenCoordinates($0, in: $1) },
308306
convertToScreenCoordinatesUsingUIView:
309-
.init { { UIAccessibility.convertToScreenCoordinates($0, in: $1) } },
307+
.init { UIAccessibility.convertToScreenCoordinates($0, in: $1) },
310308
focusedElement:
311-
.init { { UIAccessibility.focusedElement(using: $0) } },
309+
.init { UIAccessibility.focusedElement(using: $0) },
312310
guidedAccessRestrictionState:
313-
.init { { UIAccessibility.guidedAccessRestrictionState(forIdentifier: $0) } },
314-
post: .init { { UIAccessibility.post(notification: $0, argument: $1) } },
311+
.init { UIAccessibility.guidedAccessRestrictionState(forIdentifier: $0) },
312+
post: .init { UIAccessibility.post(notification: $0, argument: $1) },
315313
registerGestureConflictWithZoom: .init {
316-
{ UIAccessibility.registerGestureConflictWithZoom() }
314+
UIAccessibility.registerGestureConflictWithZoom()
317315
},
318316
requestGuidedAccessSession: .init {
319-
{ enabled in
320-
await withUnsafeContinuation { continuation in
321-
UIAccessibility.requestGuidedAccessSession(enabled: enabled) {
322-
continuation.resume(returning: $0)
323-
}
317+
enabled in
318+
await withUnsafeContinuation { continuation in
319+
UIAccessibility.requestGuidedAccessSession(enabled: enabled) {
320+
continuation.resume(returning: $0)
324321
}
325322
}
323+
326324
},
327325
zoomFocusChanged: .init {
328-
{
329-
UIAccessibility.zoomFocusChanged(zoomType: $0, toFrame: $1, in: $2)
330-
}
326+
UIAccessibility.zoomFocusChanged(zoomType: $0, toFrame: $1, in: $2)
331327
}
332328
)
333329
)
@@ -369,14 +365,14 @@
369365
UIAccessibility.shouldDifferentiateWithoutColor
370366
},
371367
convertToScreenCoordinatesUsingUIBezierPath:
372-
.init { { UIAccessibility.convertToScreenCoordinates($0, in: $1) } },
368+
.init { UIAccessibility.convertToScreenCoordinates($0, in: $1) },
373369
convertToScreenCoordinatesUsingUIView:
374-
.init { { UIAccessibility.convertToScreenCoordinates($0, in: $1) } },
370+
.init { UIAccessibility.convertToScreenCoordinates($0, in: $1) },
375371
focusedElement:
376-
.init { { UIAccessibility.focusedElement(using: $0) } },
372+
.init { UIAccessibility.focusedElement(using: $0) },
377373
guidedAccessRestrictionState:
378-
.init { { UIAccessibility.guidedAccessRestrictionState(forIdentifier: $0) } },
379-
post: .init { { UIAccessibility.post(notification: $0, argument: $1) } },
374+
.init { UIAccessibility.guidedAccessRestrictionState(forIdentifier: $0) },
375+
post: .init { UIAccessibility.post(notification: $0, argument: $1) },
380376
registerGestureConflictWithZoom: .init {
381377
{ UIAccessibility.registerGestureConflictWithZoom() }
382378
},
@@ -460,7 +456,7 @@
460456
#"@Dependency(\.accessibility.guidedAccessRestrictionState)"#,
461457
placeholder: { _ in .deny }),
462458
post: .unimplemented(
463-
#"@Dependency(\.accessibility.post)"#, placeholder: { _, _ in () }),
459+
#"@Dependency(\.accessibility.post)"#),
464460
registerGestureConflictWithZoom: .unimplemented(
465461
#"@Dependency(\.accessibility.registerGestureConflictWithZoom)"#),
466462
requestGuidedAccessSession: .unimplemented(
@@ -525,7 +521,7 @@
525521
#"@Dependency(\.accessibility.guidedAccessRestrictionState)"#,
526522
placeholder: { _ in .deny }),
527523
post: .unimplemented(
528-
#"@Dependency(\.accessibility.post)"#, placeholder: { _, _ in () }),
524+
#"@Dependency(\.accessibility.post)"#),
529525
registerGestureConflictWithZoom: .unimplemented(
530526
#"@Dependency(\.accessibility.registerGestureConflictWithZoom)"#),
531527
requestGuidedAccessSession: .unimplemented(

0 commit comments

Comments
 (0)