File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ import Shared
18
18
<#Challenge Documentation#>
19
19
*/
20
20
@main
21
- struct < #ChallengeName#> : ParsableCommand
21
+ struct < #ChallengeName#> : AsyncParsableCommand
22
22
{
23
23
/// <#Enumeration for argument which activates "Part Two" behavior#>
24
24
enum Mode : String , ExpressibleByArgument , CaseIterable
@@ -36,12 +36,10 @@ struct <#ChallengeName#>: ParsableCommand
36
36
37
37
extension < #ChallengeName#>
38
38
{
39
- mutating func run( ) throws
39
+ mutating func run( ) async throws
40
40
{
41
- while let inputLine = readLine ( )
42
- {
43
- print ( " \( inputLine) " )
44
- }
41
+ let input : AsyncLineSequence = FileHandle . standardInput. bytes. lines // URL.homeDirectory.appending(path: "Desktop/input.txt").lines
42
+ try await input. reduce ( into: [ ] ) { $0. append ( $1) } . forEach { print ( $0) }
45
43
}
46
44
}
47
45
You can’t perform that action at this time.
0 commit comments