英訳: introducing Swift (Swiftの導入)
AppleからWWDCにて新しいiOSとOSXのプログラミング用の言語「Swift」が発表されましたね。
以下Appleの公式サイトのページを訳します。
原文:https://developer.apple.com/swift/
Introducing Swift
→Swiftの導入・紹介
Swift is an innovative new programming language for Cocoa and Cocoa Touch. Writing code is interactive and fun, the syntax is concise yet expressive, and apps run lightning-fast. Swift is ready for your next iOS and OS X project — or for addition into your current app — because Swift code works side-by-side with Objective-C.
→Swiftはcocoa、cocoa touchのための革新的な新しいプログラミング言語である。コーディングは対話的で楽しく、文法は纏まっていて表現的、アプリケーションは素早く動作する。
Swiftは次期iOSとOSXプロジェクトのために準備されている。もしくは、あなたの現在のアプリの追加開発のためでもある。なぜならSwiftのコードはObjective-Cのコードと共存することができるためである。
Swift is the result of the latest research on programming languages, combined with decades of experience building Apple platforms. Named parameters brought forward from Objective-C are expressed in a clean syntax that makes APIs in Swift even easier to read and maintain.
Code
→Swiftは最新のプログラミング言語の調査・研究の結果であり、数十年のAppleのプラットフォーム構築の経験も活かされている。パラメータ名はObjective-Cの整理された文法から受け継いでおり、それがSwiftを更に可読性、メンテナンス性を高くすることに寄与している。
Inferred types make code cleaner and less prone to mistakes, while modules eliminate headers and provide namespaces. Memory is managed automatically, and you don’t even need to type semi-colons.
→型推定によりコードを綺麗に記述することができ、その結果ミスが減ることとなる同時に、モジュールからヘッダーを削除し、名前空間を提供しています。メモリは自動的に管理され、セミコロンを打つ必要もなくなりました。
Swift has many other features to make your code more expressive:
Closures unified with function pointers
Tuples and multiple return values
Generics
Fast and concise iteration over a range or collection
Structs that support methods, extensions, protocols.
Functional programming patterns, e.g.: map and filter
→Swiftには他にもあなたのコードを表現的にする多くの機能があります。
-関数ポインタに統合されたクロージャー
-タプルと複数値の返却
-ジェネリクス
-素早く簡潔な範囲やコレクションの列挙
-メソッド、拡張、プロトコルをサポートする構造体
-関数プログラミングパターン、マップやフィルター
Playgrounds make writing Swift code incredibly simple and fun. Type a line of code and the result appears immediately. If your code runs over time, for instance through a loop, you can watch its progress in the timeline assistant. The timeline displays variables in a graph, draws each step when composing a view, and can play an animated SpriteKit scene. When you’ve perfected your code in the playground, simply move that code into your project. Some uses for playgrounds include:
Design a new algorithm, watching its results every step of the way
Create new tests, verifying they work before promoting into your test suite
Experiment with new APIs to hone your Swift coding skills
→プレイグラウンドがSwiftのコーディングを簡潔で楽しいものにします。一行書くとそれがすぐに目に見える形で現れます。
ループ等であなたのコードが何度も実行される場合には、それをタイムラインアシスタントにて、グラフで実行状態を確認することが出来ます。各ステップをアニメーションを交えた形で確認できます。
完全にコードが動作することを確認したら、あなたのプロジェクトに組み込むことが出来ます。例えば以下のような用途に活用することが出来ます。
-新しいアルゴリズムをデザインし、その結果をステップ毎に確認する。
-新たなテストを作成する。それらをあなたのテストスイートに入れる前に検証する。
-新たなAPIを試験することで、Swiftのコーディングスキルを高める。
Read-Eval-Print-Loop (REPL). The debugging console in Xcode includes an interactive version of the Swift language built right in. Use Swift syntax to evaluate and interact with your running app, or write new code to see how it works in a script-like environment. Available from within the Xcode console, or in Terminal.
→Xcodeのデバッグコンソールは対話的なSwift言語が組み込まれています。Swiftの文法を使って、あなたのアプリの評価や対話操作を実行してみてください。もしくは、新たにスクリプトを書いてスクリプト環境のような環境を体験してみてください。Xcodeのコンソール、もしくはターミナルから実行することができます。
Swift eliminates entire classes of unsafe code. Variables are always initialized before use, arrays and integers are checked for overflow, and memory is managed automatically. Syntax is tuned to make it easy to define your intent — for example, simple three-character keywords define a variable (var) or constant (let).
→Swift言語からは、アンセキュアなコードが含まれているクラスを削除しています。変数は使用前に必ず初期化し、配列や整数はオーバーフローしないかチェックされ、メモリは自動的に管理されます。文法はあなたの意図を簡単に表現できるように調整されています。
例えば、単純な3文字のキーワードは変数や定数です。
The safe patterns in Swift are tuned for the powerful Cocoa and Cocoa Touch APIs. Understanding and properly handling cases where objects are nil is fundamental to the frameworks, and Swift code makes this extremely easy. Adding a single character can replace what used to be an entire line of code in Objective-C. This all works together to make building iOS and Mac apps easier and safer than ever before.
→Swift言語での安全なパターンはCocoaとcocoa touch API向けに調整されています。
オブジェクトがnilかを理解し、正しく扱うには、フレームワークの基礎です。そしてSwift言語ではこれが非常に簡単です。1文字追加することでObjective-Cでは1行丸々使って記述していたような内容のことが実現できます。これによりiOSとMacのアプリをこれまでより安全に素早く作成することが出来ます。
From its earliest conception, Swift was built to be fast. Using the incredibly high-performance LLVM compiler, Swift code is transformed into optimized native code, tuned to get the most out of modern Mac, iPhone, and iPad hardware. The syntax and standard library have also been tuned to make the most obvious way to write your code also perform the best.
→一番はじめのコンセプトとして、Swiftはアプリを高速動作させるために作られました。
パフォーマンスの良いLLVMコンパイラを活用することで、Swiftのコードは最新のMacやiPhoneやiPadのハードウェアに最適化されたネイティブコードに変換されます。
文法と標準ライブラリもまた、最もあなたのコードのパフォーマンスを良くするために明確にチューニングされています。
Swift is a successor to the C and Objective-C languages. It includes low-level primitives such as types, flow control, and operators. It also provides object-oriented features such as classes, protocols, and generics, giving Cocoa and Cocoa Touch developers the performance and power they demand.
→SwiftはCとObjective-Cを受け継ぐ言語である。SwiftはCのようなプリミティブ型や制御構文や演算子を継承しています。そして、CocoaとCocoa touchの開発者が必要としているクラスやプロトコル、ジェネリティクス等のオブジェクト志向の機能を提供しています。
You can begin using Swift code immediately to implement new features in your app, or enhance existing ones. New Swift code co-exists along side your existing Objective-C files in the same project, making it easy to adopt. And when iOS 8 and OS X Yosemite are released this fall, you can submit your apps to the App Store and Mac App Store.
→あなたのアプリに新たな機能を実装するため、もしくは現機能の改善するためにSwiftのコーディングをすぐに始めることが出来ます。
SwiftのコードはあなたのObjective-Cのコードと同じプロジェクトでも共存でき、非常に取り入れやすくなっています。そして、今秋にiOS8とOSX YOSEMITEがリリースされた際に、AppStoreやMacAppStoreにてあなたのアプリを提出・申請することができます。
To get started with Swift, download Xcode 6 beta and follow the tutorials available on Resources tab.
→Swiftを始めるためには、Xcode6 betaをダウンロードして、リソースダフのチュートリアルに従ってください。
Looking for the Swift parallel scripting language? Please visit http://swift-lang.org
→Swiftの並列プログラミングが見てみたいなら、以下のURLにアクセスしてみて!
意訳だらけで誤訳も多分に混じっているかと思います。。悪しからず。
実際にSwiftも触ってみなければならないですねー
関連記事
記事はありませんでした