diff --git a/_data/go_further.yml b/_data/go_further.yml index c79a1ee10..4ed1e0c8e 100644 --- a/_data/go_further.yml +++ b/_data/go_further.yml @@ -4,7 +4,7 @@ content_url: https://developer.apple.com/videos/play/wwdc2021/10132/ thumbnail_url: #TBD release_date: 2021-06-08 -- title: "Swift Generics" +- title: "Generics" description: "In Swift, generics are a fundamental way to write abstract code. This video walks through the basics of Swift Generics and introducing generics into your code." content_type: video content_url: https://developer.apple.com/videos/play/wwdc2021/10132/ @@ -16,7 +16,7 @@ content_url: https://developer.apple.com/videos/play/wwdc2022/110357/ thumbnail_url: #TBD release_date: 2022-06-07 -- title: "Swift Strings Under The Hood" +- title: "Strings Under The Hood" description: "Swift strings provide a fast, Unicode-compliant way to work with text. This article provides more detail on how strings are implemented in Swift using UTF-8 and the reasons behind that choice." content_type: article content_url: /blog/utf8-string/ diff --git a/documentation/index.md b/documentation/index.md index c180bc689..7794889b4 100644 --- a/documentation/index.md +++ b/documentation/index.md @@ -7,7 +7,7 @@ If you are new to Swift, you may want to check out these additional resources. ## Swift Language diff --git a/getting-started/_use-cases.md b/getting-started/_use-cases.md index 5403e8ac5..7cfe719de 100644 --- a/getting-started/_use-cases.md +++ b/getting-started/_use-cases.md @@ -9,7 +9,7 @@ Looking for a language reference? [The Swift Programming Language (TSPL)](https:
  • Command-line Tool

    - Build a command-line tool using SwiftPM. + Build a cross-platform command-line tool.

    Start tutorial @@ -18,16 +18,16 @@ Looking for a language reference? [The Swift Programming Language (TSPL)](https:
  • Library

    - Build a library using SwiftPM. + Build a cross-platform library.

    Start tutorial
  • -

    Web Server with Vapor

    +

    Web Service

    - Use the open-source Vapor framework to build a web service using SwiftPM. + Use a web framework to build a web service. Requires macOS or Linux.

    @@ -35,7 +35,7 @@ Looking for a language reference? [The Swift Programming Language (TSPL)](https:
  • -

    App for Apple platforms

    +

    iOS and macOS Application

    Use Swift and SwiftUI to build an app that works on iOS and macOS. Requires macOS 12 and Xcode 14. diff --git a/getting-started/vapor-web-server/index.md b/getting-started/vapor-web-server/index.md index b022b9c1f..35f409ded 100644 --- a/getting-started/vapor-web-server/index.md +++ b/getting-started/vapor-web-server/index.md @@ -1,13 +1,19 @@ --- layout: page -title: Build a Web Server with Vapor +title: Build a Web Service with Vapor --- {% include getting-started/_installing.md %} +## Choosing a web framework + +Over the years, the Swift community created several web frameworks designed to help building web services. +This guide focuses on the [Vapor](https://vapor.codes) web framework, a popular choice with the community. + ## Installing Vapor -This guide uses the [Vapor](https://vapor.codes) web framework to build a server application. First, you need to install the Vapor toolbox. If you already have Homebrew installed on macOS, run +First, you need to install the Vapor toolbox. +If you already have Homebrew installed on macOS, run ```bash brew install vapor @@ -57,7 +63,7 @@ app.get("hello", ":name") { req async throws -> String in } ``` -Here's what the code does: +Here's what the code does: 1. Declare a new route handler registered as a **GET** request to `/hello/`. The `:` denotes a dynamic path parameter in Vapor and will match any value and allow you to retrieve it in your route handler. `app.get(...)` takes a closure as the final parameter that can be asynchronous and must return a `Response` or something conforming to `ResponseEncodable`, such as `String`. 2. Get the name from the parameters. By default, this returns a `String`. If you want to extract another type, such as `Int` or `UUID` you can write `req.parameters.require("id", as: UUID.self)` and Vapor will attempt to cast it to the type and automatically throw an error if it's unable to. This throws an error if the route hasn't been registered with the correct parameter name. diff --git a/index.md b/index.md index 179059d7f..05c14726d 100644 --- a/index.md +++ b/index.md @@ -9,9 +9,9 @@ atom: true Swift is a general-purpose programming language built using a modern approach to safety, performance, and software design patterns.

    ## Why Swift? @@ -57,7 +57,7 @@ No matter how you want to get involved, we ask that you first learn what’s exp Anyone with a good idea can help shape the future features and direction of the language. To reach the best possible solution to a problem, we discuss and iterate on ideas in a public forum. ### Code @@ -84,4 +84,4 @@ Stay up-to-date with the latest in the Swift community. - [Visit the Swift.org blog](/blog/) - [Visit the Swift forums](https://forums.swift.org) - [Follow @Swiftlang on Twitter](https://twitter.com/swiftlang){:target="_blank" class="link-external"} - \ No newline at end of file +