# Introduction to Swift

## Swift &#x20;

![](https://34010127-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lbu5l8BZgxd-sQokTY4%2F-LeBq_iWej4lk1qRYZFz%2F-LeBsHlYXUkRfCYFFvw9%2FScreen%20Shot%202019-05-06%20at%2018.21.13.png?alt=media\&token=d38da3bb-5c54-491c-8d67-42048b00139e)

ภาษา Swift ได้ถูกแนะนำให้นักพัฒนาทั่วโลกได้รู้จักในงาน WWDC 2014 เพื่อใช้เป็นภาษายุคใหม่ที่มีความกระชับคล้ายกับ Ruby และ JavaScript สามารถทำงานได้รวดเร็ว และง่ายต่อการพัฒนาแอปพลิเคชันสำหรับอุปกรณ์ของแอปเปิล โดยสิ่งที่คุณต้องจัดเตรียมเพื่อการเรียนรู้วิธีการเขียนคำสั่งด้วยภาษา Swift และการสร้าง iOS Appliction ประกอบด้วย

* เครื่องคอมพิวเตอร์ส่วนบุคคล เช่น MacBook, iMac หรือ Mac mini ซึ่งทำงานบนระบบปฏิบัติการ macOS รุ่นล่าสุด
* บัญชีผู้ใช้งาน Apple ID ซึ่งสามารถสมัครได้ที่ <https://appleid.apple.com/>&#x20;
* โปรแกรม Xcode รุ่นล่าสุด ดาวน์โหลดได้จาก [App Store](https://itunes.apple.com/th/app/xcode/id497799835?mt=12) หรือ <https://developer.apple.com/xcode/>
* เครื่อง iPad, iPhone, AppleTV หรือ Apple Watch (หากต้องการทดสอบการทำงานบนอุปกรณ์จริง)

Swift 5.3 ยังรองรับการพัฒนาโปรแกรมแบบเต็มรูปแบบบน Windows โดยการเขียนโปรแกรมด้วยภาษา Swift บนระบบปฏิบัติการวินโดว์นั้นจำเป็นต้องติดตั้งโปรแกรม Visual Studio 2019, Windows 10 SDK, Windows Universal C Runtime และดาวน์โหลดแพ็กเกจของ Swift เพิ่มเติมได้จากเว็บไซต์ <https://swift.org>

สำหรับแหล่งข้อมูลเพื่อใช้อ้างอิงหรือประกอบการเรียนรู้วิธีการเขียนคำสั่งด้วยภาษา Swift และการพัฒนา iOS Application อย่างเป็นทางการของ Apple ประกอบด้วย

* [The Swift Programming Language (Swift 5.2 beta)](https://books.apple.com/th/book/the-swift-programming-language-swift-5-2-beta/id1002622538), Apple Inc., 2020
* [Intro to App Development with Swift](https://books.apple.com/th/book/intro-to-app-development-with-swift/id1118575552), Apple Inc., 2017.
* [App Development with Swift](https://books.apple.com/th/book/app-development-with-swift/id1465002990), Apple Inc., 2017.
* [Getting Started with Swift](https://developer.apple.com/videos/play/wwdc2016/404/), in WWDC 2016 - Session 404, Apple Inc., 2016.
* [Swift.org](https://swift.org), เว็บไซต์เพื่อการแลกเปลี่ยนเรียนรู้เกี่ยวกับภาษา Swift

## Xcode

![](https://34010127-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lbu5l8BZgxd-sQokTY4%2F-LeY2C54onpOar3g1RXV%2F-LeY2GbNLiidObcp9Pr1%2FScreen%20Shot%202019-05-11%20at%2001.40.46.png?alt=media\&token=e3f04382-8803-4a61-b406-e6fe147aef0c)

**Xcode** คือ เครื่องมือบนระบบปฏิบัติการ macOS ที่ใช้เพื่อการสร้างและพัฒนาแอพพลิเคชั่นสำหรับ macOS, iOS, WatchOS และ tvOS โดย Xcode มาพร้อมกับเครื่องมือทุกอย่างที่จำเป็นต้องใช้เพื่อสร้างสรรค์แอปที่แสนมหัศจรรย์ อาทิ หน้าจอสำหรับการเขียนคำสั่ง, หน้าจอสำหรับการออกแบบส่วนติดต่อกับผู้ใช้ และส่วนสำหรับจำลองการทำงาน (Simulator) ของอุปกรณ์ต่างๆ&#x20;

![](https://34010127-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lbu5l8BZgxd-sQokTY4%2F-LeE46ckwfVyi2NHao_m%2F-LeE8peiBHS8WDLNxbM7%2Fplayground.png?alt=media\&token=75a2fac1-0e18-4ae0-82f0-b3c9840080f2)

**Playground** คือ ตัวช่วยสำหรับการเรียนรู้ภาษา Swift ที่ดีที่สุด เนื่องจากมีระบบโต้ตอบอัตโนมัติที่จะทำให้เราเห็นผลลัพธ์ได้ทันทีเมื่อเขียนคำสั่งในภาษา Swift&#x20;

{% hint style="info" %}
**รายละเอียดเพื่อการอ้างอิง**\
**ผู้เขียน** ธิติ ธีระเธียร  \
**วันที่เผยแพร่**  วันที่ 13 เมษายน 2562\
**วันที่ปรุงปรุงล่าสุด** วันที่ 1 กุมภาพันธ์ 2563\
**เข้าถึงได้จาก** <https://ajthiti.gitbook.io/swift/>\
**เงื่อนใขในการใช้งาน**\
This work is licensed under a [Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License](http://creativecommons.org/licenses/by-nc-nd/4.0/).
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ajthiti.gitbook.io/swift/master.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
