File tree Expand file tree Collapse file tree 2 files changed +7
-7
lines changed
Sources/ComposableArchitecture/Documentation.docc/Articles Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -353,7 +353,7 @@ struct MyApp: App {
353
353
numberFact : { number in
354
354
let (data, _ ) = try await URLSession.shared
355
355
.data (from : .init (string : " http://numbersapi.com/\( number ) " )! )
356
- return String (decoding : data, using : UTF8 .self )
356
+ return String (decoding : data, as : UTF8 .self )
357
357
}
358
358
)
359
359
)
Original file line number Diff line number Diff line change @@ -124,8 +124,8 @@ struct Feature: ReducerProtocol {
124
124
TaskResult {
125
125
String (
126
126
decoding : try await URLSession.shared
127
- .data (from : URL (string : " http://numbersapi.com/\( number ) /trivia" )! ).0,
128
- using : UTF8 .self
127
+ .data (from : URL (string : " http://numbersapi.com/\( count ) /trivia" )! ).0,
128
+ as : UTF8 .self
129
129
)
130
130
}
131
131
)
@@ -346,10 +346,10 @@ struct MyApp: App {
346
346
store : Store (
347
347
initialState : Feature.State (),
348
348
reducer : Feature (
349
- numberFact : {
349
+ numberFact : { number in
350
350
let (data, _ ) = try await URLSession.shared
351
351
.data (from : .init (string : " http://numbersapi.com/\( number ) " )! )
352
- return String (decoding : data, using : UTF8 .self )
352
+ return String (decoding : data, as : UTF8 .self )
353
353
}
354
354
)
355
355
)
@@ -409,10 +409,10 @@ dependency to be used by default:
409
409
``` swift
410
410
private enum NumberFactClientKey : DependencyKey {
411
411
static let liveValue = NumberFactClient (
412
- fetch : {
412
+ fetch : { number in
413
413
let (data, _ ) = try await URLSession.shared
414
414
.data (from : .init (string : " http://numbersapi.com/\( number ) " )! )
415
- return String (decoding : data, using : UTF8 .self )
415
+ return String (decoding : data, as : UTF8 .self )
416
416
}
417
417
)
418
418
}
You can’t perform that action at this time.
0 commit comments