-
What's new in Swift
Join us for an update on Swift. Discover the latest advancements in runtime performance, along with improvements to the developer experience that make your code faster to read, edit, and debug. Find out how to take advantage of new language features like multiple trailing closures. Learn about new libraries available in the SDK, and explore the growing number of APIs available as Swift Packages.
Recursos
- Swift Standard Library Preview
- Swift Argument Parser on GitHub
- Swift Evolution
- Swift Numerics on GitHub
- The Swift Programming Language
Vídeos relacionados
WWDC20
-
Buscar neste vídeo...
-
-
13:32 - Swift on AWS Lambda
import AWSLambdaRuntime Lambda.run { (_, event: String, callback) in callback(.success("Hello, \(event)")) } -
21:08 - @main
// Type-based program entry points import ArgumentParser @main struct Hello: ParsableCommand { @Argument(help: "The name to greet.") var name: String func run() { print("Hello, \(name)!") } } -
23:50 - Synthesized comparable conformance for enums
// Synthesized comparable conformance for enums enum MessageStatus: Hashable, Comparable { case draft case saved case failedToSend case sent case delivered case read var wasSent: Bool { self >= .sent } } -
27:19 - Compress and archive a source directory using Apple Archive
// Apple Archive import AppleArchive try ArchiveByteStream.withFileStream( path: "/tmp/VacationPhotos.aar", mode: .writeOnly, options: [.create, .truncate], permissions: [.ownerReadWrite, .groupRead, .otherRead] ) { file in // Receives raw bytes and writes compressed bytes to `file` try ArchiveByteStream.withCompressionStream(using: .lzfse, writingTo: file) { compressor in // Receives archive entries, and writes bytes to `compressor` try ArchiveStream.withEncodeStream(writingTo: compressor) { encoder in // Writes all entries from `src` to `encoder` try encoder.writeDirectoryContents(archiveFrom: source, keySet: fieldKeySet) } } } -
28:34 - OSLog support for String interpolations and formatting options
logger.log("\(offerID, align: .left(columns: 10), privacy: .public)") // Logs "E1Z3F " logger.log("\(seconds, format: .fixed(precision: 2)) seconds") // Logs "1.30 seconds" -
30:05 - ArgumentParser Swift Package
// Swift ArgumentParser import ArgumentParser @main struct Hello: ParsableCommand { @Option(name: .shortAndLong, help: "The number of times to say hello.") var count: Int = 1 @Argument(help: "The name to greet.") var name: String func run() { for _ in 1...count { print("Hello, \(name)!") } } }
-