Skip to content

Commit 0332b34

Browse files
authored
Fix HelloWorld examples (#1512)
Resolves #1511
1 parent 3677a71 commit 0332b34

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

Sources/Examples/HelloWorld/Client/main.swift renamed to Sources/Examples/HelloWorld/Client/HelloWorldClient.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import NIOCore
2121
import NIOPosix
2222

2323
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
24+
@main
2425
struct HelloWorld: AsyncParsableCommand {
2526
@Option(help: "The port to connect to")
2627
var port: Int = 1234
@@ -67,4 +68,11 @@ struct HelloWorld: AsyncParsableCommand {
6768
}
6869
}
6970
}
71+
#else
72+
@main
73+
enum HelloWorld {
74+
static func main() {
75+
fatalError("This example requires swift >= 5.6")
76+
}
77+
}
7078
#endif // compiler(>=5.6)

Sources/Examples/HelloWorld/Server/main.swift renamed to Sources/Examples/HelloWorld/Server/HelloWorldServer.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import NIOCore
2121
import NIOPosix
2222

2323
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
24+
@main
2425
struct HelloWorld: AsyncParsableCommand {
2526
@Option(help: "The port to listen on for new connections")
2627
var port = 1234
@@ -43,4 +44,11 @@ struct HelloWorld: AsyncParsableCommand {
4344
try await server.onClose.get()
4445
}
4546
}
47+
#else
48+
@main
49+
enum HelloWorld {
50+
static func main() {
51+
fatalError("This example requires swift >= 5.6")
52+
}
53+
}
4654
#endif // compiler(>=5.6)

0 commit comments

Comments
 (0)