You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import ComposableArchitecture
import Foundation
import XCTestDynamicOverlay
//: RegisterstructFactClient{varfetch:@Sendable(Int)asyncthrows->String}extensionDependencyValues{varfactClient:FactClient{get{self[FactClient.self]}set{self[FactClient.self]= newValue }}}extensionFactClient:DependencyKey{/// This is the "live" fact dependency that reaches into the outside world to fetch trivia./// Typically this live implementation of the dependency would live in its own module so that the/// main feature doesn't need to compile it.staticletliveValue=Self(
fetch:{ number intryawaitTask.sleep(for:.seconds(1))let(data, _)=tryawaitURLSession.shared
.data(from:URL(string:"http://numbersapi.com/\(number)/trivia")!)returnString(decoding: data, as:UTF8.self)})/// This is the "unimplemented" fact dependency that is useful to plug into tests that you want/// to prove do not need the dependency.staticlettestValue=Self(
fetch:unimplemented("\(Self.self).fetch"))}//: Usage@Dependency(\.factClient)varfactClientletnumber:Int=2letresult=tryawait factClient.fetch(number)
The text was updated successfully, but these errors were encountered: