Skip to content

Commit

Permalink
Fix HelloWorld examples (grpc#1512)
Browse files Browse the repository at this point in the history
Resolves grpc#1511
  • Loading branch information
glbrntt authored and WendellXY committed Aug 24, 2023
1 parent 494920d commit 92a9c6b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import NIOCore
import NIOPosix

@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
@main
struct HelloWorld: AsyncParsableCommand {
@Option(help: "The port to connect to")
var port: Int = 1234
Expand Down Expand Up @@ -67,4 +68,11 @@ struct HelloWorld: AsyncParsableCommand {
}
}
}
#else
@main
enum HelloWorld {
static func main() {
fatalError("This example requires swift >= 5.6")
}
}
#endif // compiler(>=5.6)
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import NIOCore
import NIOPosix

@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
@main
struct HelloWorld: AsyncParsableCommand {
@Option(help: "The port to listen on for new connections")
var port = 1234
Expand All @@ -43,4 +44,11 @@ struct HelloWorld: AsyncParsableCommand {
try await server.onClose.get()
}
}
#else
@main
enum HelloWorld {
static func main() {
fatalError("This example requires swift >= 5.6")
}
}
#endif // compiler(>=5.6)

0 comments on commit 92a9c6b

Please sign in to comment.