# Swift Package Manager (iOS) > Swift Package Manager, Package.swift, dependencies, การกำหนดเวอร์ชัน, local packages - 16 คำถามสัมภาษณ์ - Mid-Level - [คำถามสัมภาษณ์: iOS](https://sharpskill.dev/th/technologies/ios/interview-questions.md) ## 1. ไฟล์ manifest หลักที่จำเป็นสำหรับการกำหนด Swift Package คืออะไร? **คำตอบ** ไฟล์ Package.swift เป็น manifest ที่จำเป็นสำหรับทุก Swift Package โดยมี metadata ของแพ็กเกจ, dependencies, target และ product หากไม่มีไฟล์นี้ที่ root ของแพ็กเกจ Xcode จะไม่สามารถรับรู้โครงสร้างนั้นว่าเป็นแพ็กเกจที่ถูกต้องได้ ## 2. จะกำหนด target ที่สามารถรันได้ใน SPM อย่างไร? **คำตอบ** executable target จะสร้างแอปพลิเคชันหรือเครื่องมือ command-line โดยต่างจาก library target ตรงที่สร้าง binary ที่รันได้แบบ standalone executable target ต้องมี entry point ที่ถูกต้อง (ไฟล์ main.swift หรือ @main) จึงจะคอมไพล์ได้อย่างถูกต้อง SPM ใช้ .executableTarget() ใน Package.swift เพื่อกำหนด target ประเภทนี้ ## 3. ความแตกต่างระหว่าง target กับ product ใน SPM คืออะไร? **คำตอบ** target คือหน่วยการคอมไพล์ที่บรรจุซอร์สโค้ด ส่วน product คือสิ่งที่นำไปใช้งานได้ซึ่งสร้างจากหนึ่ง target หรือมากกว่า product จะเปิดเผย target สู่ภายนอกและกำหนดว่าจะแจกจ่ายอย่างไร ตัวอย่างเช่น target เดียวกันสามารถถูกเปิดเผยเป็น library แบบ static หรือ dynamic ได้ขึ้นอยู่กับ product การแยกส่วนนี้ให้ความยืดหยุ่นในการแจกจ่ายโค้ดในขณะที่รวมศูนย์ logic การคอมไพล์ไว้ที่เดียว ## มีอีก 13 คำถาม - จะประกาศ dependency จากระยะไกลใน SPM อย่างไร? - บทบาทของ dependency ในเครื่อง (local) ใน SPM คืออะไร? สมัครฟรี: https://sharpskill.dev/th/login ## หัวข้อสัมภาษณ์ iOS อื่นๆ - [พื้นฐาน Swift](https://sharpskill.dev/th/technologies/ios/interview-questions/swift-basics.md): 25 คำถาม, Junior - [พื้นฐานภาษา Swift](https://sharpskill.dev/th/technologies/ios/interview-questions/swift-language-essentials.md): 15 คำถาม, Junior - [พื้นฐาน UIKit](https://sharpskill.dev/th/technologies/ios/interview-questions/uikit-fundamentals.md): 18 คำถาม, Junior - [วงจรชีวิตของ UIViewController](https://sharpskill.dev/th/technologies/ios/interview-questions/uiviewcontroller-lifecycle.md): 20 คำถาม, Junior - [UserDefaults & Keychain](https://sharpskill.dev/th/technologies/ios/interview-questions/userdefaults-keychain.md): 20 คำถาม, Junior - [วงจรชีวิตของแอปพลิเคชัน](https://sharpskill.dev/th/technologies/ios/interview-questions/app-lifecycle.md): 20 คำถาม, Junior - [Auto Layout & Constraints](https://sharpskill.dev/th/technologies/ios/interview-questions/auto-layout-constraints.md): 24 คำถาม, Mid-Level - [UITableView & UICollectionView](https://sharpskill.dev/th/technologies/ios/interview-questions/uitableview-uicollectionview.md): 25 คำถาม, Mid-Level - [พื้นฐาน SwiftUI](https://sharpskill.dev/th/technologies/ios/interview-questions/swiftui-basics.md): 18 คำถาม, Mid-Level - [การจัดการ State ใน SwiftUI](https://sharpskill.dev/th/technologies/ios/interview-questions/swiftui-state-management.md): 22 คำถาม, Mid-Level - [การนำทาง SwiftUI](https://sharpskill.dev/th/technologies/ios/interview-questions/swiftui-navigation.md): 18 คำถาม, Mid-Level - [Networking & URLSession](https://sharpskill.dev/th/technologies/ios/interview-questions/networking-urlsession.md): 20 คำถาม, Mid-Level - [Codable และการแยกวิเคราะห์ JSON](https://sharpskill.dev/th/technologies/ios/interview-questions/codable-json-parsing.md): 20 คำถาม, Mid-Level - [Core Data](https://sharpskill.dev/th/technologies/ios/interview-questions/core-data.md): 22 คำถาม, Mid-Level - [การเขียนโปรแกรมเชิงโปรโตคอล](https://sharpskill.dev/th/technologies/ios/interview-questions/protocol-oriented-programming.md): 20 คำถาม, Mid-Level - [สถาปัตยกรรม MVVM](https://sharpskill.dev/th/technologies/ios/interview-questions/mvvm-architecture.md): 20 คำถาม, Mid-Level - [การแจ้งเตือนแบบ Push](https://sharpskill.dev/th/technologies/ios/interview-questions/push-notifications.md): 18 คำถาม, Mid-Level - [Unit Testing และ XCTest](https://sharpskill.dev/th/technologies/ios/interview-questions/unit-testing-xctest.md): 20 คำถาม, Mid-Level - [การทดสอบ UI](https://sharpskill.dev/th/technologies/ios/interview-questions/ui-testing.md): 18 คำถาม, Mid-Level - [Xcode และระบบ Build](https://sharpskill.dev/th/technologies/ios/interview-questions/xcode-build-system.md): 16 คำถาม, Mid-Level - [Memory Management & ARC](https://sharpskill.dev/th/technologies/ios/interview-questions/memory-management-arc.md): 22 คำถาม, Senior - [Combine Framework](https://sharpskill.dev/th/technologies/ios/interview-questions/combine-framework.md): 24 คำถาม, Senior - [Concurrency & async/await](https://sharpskill.dev/th/technologies/ios/interview-questions/concurrency-async-await.md): 26 คำถาม, Senior - [iOS Design Patterns](https://sharpskill.dev/th/technologies/ios/interview-questions/ios-design-patterns.md): 24 คำถาม, Senior - [การเพิ่มประสิทธิภาพ](https://sharpskill.dev/th/technologies/ios/interview-questions/performance-optimization.md): 22 คำถาม, Senior - [ความปลอดภัยและการเข้ารหัส](https://sharpskill.dev/th/technologies/ios/interview-questions/security-encryption.md): 20 คำถาม, Senior - [SwiftUI Advanced](https://sharpskill.dev/th/technologies/ios/interview-questions/swiftui-advanced.md): 22 คำถาม, Senior - [สถาปัตยกรรมแอปพลิเคชัน iOS](https://sharpskill.dev/th/technologies/ios/interview-questions/ios-app-architecture.md): 22 คำถาม, Senior --- Source: SharpSkill (https://sharpskill.dev), tech interview preparation for your real stack. HTML version of this page: https://sharpskill.dev/th/technologies/ios/interview-questions/swift-package-manager