Repository navigation
Generic parameter 'Result' could not be inferred #28
Answered
by
stephencelis
kgrigsby59
asked this question in
Q&A
|
I have the following: I'm getting a compile error |
Answered by
stephencelis
Jul 27, 2022
Replies: 1 comment 1 reply
|
@kgrigsby59 extension SpotlightClient {
public static let unimplemented = Self(
- refreshSpotlightIndex: { XCTUnimplemented("\(Self.self).refreshSpotlightIndex") }
+ refreshSpotlightIndex: XCTUnimplemented("\(Self.self).refreshSpotlightIndex")
)
}Basically, call |
1 reply
Answer selected by
kgrigsby59
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@kgrigsby59
XCTUnimplementedis meant as a dependency "generator" of sorts, so it's responsible for emitting a function that will fail when called later (as opposed toXCTFail, which fails immediately when called). I think you can do the following to get things building:extension SpotlightClient { public static let unimplemented = Self( - refreshSpotlightIndex: { XCTUnimplemented("\(Self.self).refreshSpotlightIndex") } + refreshSpotlightIndex: XCTUnimplemented("\(Self.self).refreshSpotlightIndex") ) }Basically, call
XCTUnimplementedin place of the endpoint's closure, not within the endpoint's closure.