Skip to content

Commit

Permalink
Improve Proxies ergonomics (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
tgrapperon authored Jan 30, 2023
1 parent 41f388d commit 842f6f2
Show file tree
Hide file tree
Showing 22 changed files with 2,101 additions and 1,366 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/xctest-dynamic-overlay",
"state" : {
"revision" : "a9daebf0bf65981fd159c885d504481a65a75f02",
"version" : "0.8.0"
"revision" : "16b23a295fa322eb957af98037f86791449de60f",
"version" : "0.8.1"
}
}
],
Expand Down
58 changes: 27 additions & 31 deletions Sources/AccessibilityDependency/AccessibilityDependency_iOS.swift
Original file line number Diff line number Diff line change
Expand Up @@ -289,45 +289,41 @@
UIAccessibility.shouldDifferentiateWithoutColor
},
configureForGuidedAccess:
.init {
{ features, enabled in
try await withUnsafeThrowingContinuation { continuation in
UIAccessibility.configureForGuidedAccess(features: features, enabled: enabled) {
enabled, error in
if let error {
continuation.resume(with: .failure(error))
} else {
continuation.resume(with: .success(enabled))
}
.init { features, enabled in
try await withUnsafeThrowingContinuation { continuation in
UIAccessibility.configureForGuidedAccess(features: features, enabled: enabled) {
enabled, error in
if let error {
continuation.resume(with: .failure(error))
} else {
continuation.resume(with: .success(enabled))
}
}
}
},
convertToScreenCoordinatesUsingUIBezierPath:
.init { { UIAccessibility.convertToScreenCoordinates($0, in: $1) } },
.init { UIAccessibility.convertToScreenCoordinates($0, in: $1) },
convertToScreenCoordinatesUsingUIView:
.init { { UIAccessibility.convertToScreenCoordinates($0, in: $1) } },
.init { UIAccessibility.convertToScreenCoordinates($0, in: $1) },
focusedElement:
.init { { UIAccessibility.focusedElement(using: $0) } },
.init { UIAccessibility.focusedElement(using: $0) },
guidedAccessRestrictionState:
.init { { UIAccessibility.guidedAccessRestrictionState(forIdentifier: $0) } },
post: .init { { UIAccessibility.post(notification: $0, argument: $1) } },
.init { UIAccessibility.guidedAccessRestrictionState(forIdentifier: $0) },
post: .init { UIAccessibility.post(notification: $0, argument: $1) },
registerGestureConflictWithZoom: .init {
{ UIAccessibility.registerGestureConflictWithZoom() }
UIAccessibility.registerGestureConflictWithZoom()
},
requestGuidedAccessSession: .init {
{ enabled in
await withUnsafeContinuation { continuation in
UIAccessibility.requestGuidedAccessSession(enabled: enabled) {
continuation.resume(returning: $0)
}
enabled in
await withUnsafeContinuation { continuation in
UIAccessibility.requestGuidedAccessSession(enabled: enabled) {
continuation.resume(returning: $0)
}
}

},
zoomFocusChanged: .init {
{
UIAccessibility.zoomFocusChanged(zoomType: $0, toFrame: $1, in: $2)
}
UIAccessibility.zoomFocusChanged(zoomType: $0, toFrame: $1, in: $2)
}
)
)
Expand Down Expand Up @@ -369,14 +365,14 @@
UIAccessibility.shouldDifferentiateWithoutColor
},
convertToScreenCoordinatesUsingUIBezierPath:
.init { { UIAccessibility.convertToScreenCoordinates($0, in: $1) } },
.init { UIAccessibility.convertToScreenCoordinates($0, in: $1) },
convertToScreenCoordinatesUsingUIView:
.init { { UIAccessibility.convertToScreenCoordinates($0, in: $1) } },
.init { UIAccessibility.convertToScreenCoordinates($0, in: $1) },
focusedElement:
.init { { UIAccessibility.focusedElement(using: $0) } },
.init { UIAccessibility.focusedElement(using: $0) },
guidedAccessRestrictionState:
.init { { UIAccessibility.guidedAccessRestrictionState(forIdentifier: $0) } },
post: .init { { UIAccessibility.post(notification: $0, argument: $1) } },
.init { UIAccessibility.guidedAccessRestrictionState(forIdentifier: $0) },
post: .init { UIAccessibility.post(notification: $0, argument: $1) },
registerGestureConflictWithZoom: .init {
{ UIAccessibility.registerGestureConflictWithZoom() }
},
Expand Down Expand Up @@ -460,7 +456,7 @@
#"@Dependency(\.accessibility.guidedAccessRestrictionState)"#,
placeholder: { _ in .deny }),
post: .unimplemented(
#"@Dependency(\.accessibility.post)"#, placeholder: { _, _ in () }),
#"@Dependency(\.accessibility.post)"#),
registerGestureConflictWithZoom: .unimplemented(
#"@Dependency(\.accessibility.registerGestureConflictWithZoom)"#),
requestGuidedAccessSession: .unimplemented(
Expand Down Expand Up @@ -525,7 +521,7 @@
#"@Dependency(\.accessibility.guidedAccessRestrictionState)"#,
placeholder: { _ in .deny }),
post: .unimplemented(
#"@Dependency(\.accessibility.post)"#, placeholder: { _, _ in () }),
#"@Dependency(\.accessibility.post)"#),
registerGestureConflictWithZoom: .unimplemented(
#"@Dependency(\.accessibility.registerGestureConflictWithZoom)"#),
requestGuidedAccessSession: .unimplemented(
Expand Down
Loading

0 comments on commit 842f6f2

Please sign in to comment.