& Interfaces Swift Libraries SwiftyJSON SwiftMongoDB Swift Binary Foundation Package Manager C Libraries Dispatch HttpParser HiRedis CURL PCRE2 Pluggable Components
App Bringing Swift to the Server Foundation Swift Swift Standard Library Core Foundation Dispatch PWQ C libs GLibc Foundation Swift Swift Standard Library Core Foundation Dispatch Darwin C libs Client-specific Libraries App Libraries Server-specific Libraries App Libraries Driving Towards Consistent Runtime across Clients/Servers Server-side Environments (Built with Foundation & Libdispatch)
Sources │ └── main.swift └── Tests $ mkdir myProject && cd myProject 2. Next, initialize this project as a new Swift package 1. First, we create a new project directory $ swift package init --type executable Basic Swift package directory structure:
Kitura.run() let router = Router() router.get("/hello") { request, response, next in response.status(.OK).send("<h1>Hello, World!</h1>").end() } 6. Create and start an HTTPServer: 4. Add a router and a path: router.get("/hello.json") { request, response, next in response.status(.OK).send(json: JSON(["Hello": "World!"])).end() } 5. Add a JSON data route
s = Select(from: t1) s.execute(connection) { queryResult in if let resultSet = queryResult.asResultSet { for title in resultSet.titles { ... } for row in resultSet.rows { for value in row { ... } } } else if let queryError = result.asError { ... } } 27
>= 0 GROUP BY a HAVING SUM(b) > 3 ORDER BY a DESC; … let s = Select(ucase(t1.a).as("name"), from: t1) .where(t1.b >= 0) .group(by: t1.a) .having(sum(t1.b) > 3) .order(by: .DESC(t1.a)) … 28