# SiriKit & Voice Integration Rehberi
Sesli asistanlar, mobil uygulamalarin en dogal etkilesim kanallarindan biridir. Apple'in SiriKit ve App Intents framework'leri, uygulamanizi Siri ile entegre etmenizi, Shortcuts destegi eklemenizi ve sesle kontrol edilebilir bir deneyim sunmanizi saglar. Bu rehberde SiriKit'in temellerinden App Intents'in modern API'sine kadar tum sesli entegrasyon yontemlerini inceleyecegiz.
"En iyi arayuz, arayuzu olmayan arayuzdur — sesinizle her seyi yapabilmek." — Voice-First Design
Icindekiler
- SiriKit ve App Intents Nedir?
- SiriKit vs App Intents Karsilastirmasi
- App Intents ile Modern Entegrasyon
- Custom Intent Olusturma
- Parameter Resolution
- Shortcuts Entegrasyonu
- Siri Domains
- Voice Interaction UX
- Testing ve Debugging
- Okuyucu Odulu
- Sonuc
1. SiriKit ve App Intents Nedir?
SiriKit, iOS 10'dan beri mevcut olan Siri entegrasyon framework'udur. App Intents ise iOS 16+ ile gelen modern yerine gecmesidir.
Framework Karsilastirmasi
Ozellik | SiriKit (Legacy) | App Intents (Modern) |
|---|---|---|
iOS Versiyon | iOS 10+ | iOS 16+ |
Tanimlama | Intent Definition File | Swift code |
Extension | Siri Extension gerekli | Extension gereksiz |
Domain | Sinirli domain'ler | Sinirsiz |
Shortcuts | Ayri entegrasyon | Otomatik |
Spotlight | Ayri entegrasyon | Otomatik |
Focus Filter | Desteklemez | Destekler |
Interactive Widgets | Desteklemez | Destekler |
Kod Miktari | Fazla boilerplate | Minimal |
2. Hangi Framework'u Secmeli?
iOS 16+ hedefliyorsaniz kesinlikle App Intents kullanin. Daha az kod, daha fazla ozellik ve gelecege yonelik destek sunar. SiriKit sadece iOS 10-15 destek gerekliligi varsa kullanilmali.
3. App Intents ile Modern Entegrasyon
swift
1import AppIntents2 3// Basit bir App Intent tanimlama4struct OpenArticleIntent: AppIntent {5 static var title: LocalizedStringResource = "Makale Ac"6 static var description: IntentDescription = "Belirtilen makaleyi uygulamada acar"7 8 // Parametre tanimlama9 @Parameter(title: "Makale")10 var article: ArticleEntity11 12 // Siri'nin gosterecegi ozet13 static var parameterSummary: some ParameterSummary {14 Summary("\(\.article) makalesini ac")15 }16 17 // Intent calistirildiginda18 func perform() async throws -> some IntentResult & ProvidesDialog {19 // Makaleyi ac20 await NavigationManager.shared.openArticle(article.id)21 22 return .result(dialog: "\(article.title) makalesi acildi")23 }24}25 26// Entity tanimlama - Siri'nin anlayacagi veri tipi27struct ArticleEntity: AppEntity {28 static var typeDisplayRepresentation: TypeDisplayRepresentation = "Makale"29 static var defaultQuery = ArticleQuery()30 31 var id: String32 var title: String33 var category: String34 35 var displayRepresentation: DisplayRepresentation {36 DisplayRepresentation(title: "\(title)", subtitle: "\(category)")37 }38}39 40// Entity query - Siri'nin entity'leri bulmasi icin41struct ArticleQuery: EntityQuery {42 func entities(for identifiers: [String]) async throws -> [ArticleEntity] {43 return identifiers.compactMap { id in44 ArticleStore.shared.find(by: id).map { article in45 ArticleEntity(id: article.id, title: article.title, category: article.category)46 }47 }48 }49 50 func suggestedEntities() async throws -> [ArticleEntity] {51 return ArticleStore.shared.recentArticles().map { article in52 ArticleEntity(id: article.id, title: article.title, category: article.category)53 }54 }55}4. Custom Intent Ornekleri
Siparis Takibi Intent
swift
1import AppIntents2 3struct CheckOrderStatusIntent: AppIntent {4 static var title: LocalizedStringResource = "Siparis Durumu"5 static var description: IntentDescription = "Son siparisin durumunu kontrol eder"6 7 static var openAppWhenRun: Bool = false8 9 func perform() async throws -> some IntentResult & ProvidesDialog & ShowsSnippetView {10 guard let order = try await OrderService.shared.getLatestOrder() else {11 return .result(12 dialog: "Aktif siparisinis bulunamadi"13 ) {14 OrderStatusView(order: nil)15 }16 }17 18 let statusText: String19 switch order.status {20 case .preparing:21 statusText = "hazirlaniyor"22 case .shipped:23 statusText = "kargoya verildi"24 case .delivered:25 statusText = "teslim edildi"26 case .cancelled:27 statusText = "iptal edildi"28 }29 30 return .result(31 dialog: "Siparisiniz \(statusText)"32 ) {33 OrderStatusView(order: order)34 }35 }36}Easter Egg
Gizli bir bilgi buldun!
Bu bölümde gizli bir bilgi var. Keşfetmek ister misin?
5. Parameter Resolution
Siri, kullanicinin soylediklerini parametrelere donusturmek icin resolution sureci kullanir.
swift
1import AppIntents2 3struct SendMessageIntent: AppIntent {4 static var title: LocalizedStringResource = "Mesaj Gonder"5 6 @Parameter(title: "Alici", requestValueDialog: "Kime mesaj gondermek istiyorsunuz?")7 var recipient: ContactEntity8 9 @Parameter(title: "Mesaj", requestValueDialog: "Ne yazmak istiyorsunuz?")10 var message: String11 12 static var parameterSummary: some ParameterSummary {13 Summary("\(\.recipient) kisisine \(\.message) mesajini gonder")14 }15 16 func perform() async throws -> some IntentResult & ProvidesDialog {17 try await MessageService.shared.send(18 to: recipient.id,19 message: message20 )21 22 return .result(dialog: "Mesaj gonderildi")23 }24}6. Shortcuts Entegrasyonu
App Intents ile Shortcuts entegrasyonu otomatiktir. Kullanicilar intent'lerinizi Shortcuts uygulamasinda bulabilir ve otomasyon olusturabilir.
Shortcuts Provider
swift
1import AppIntents2 3struct MyAppShortcuts: AppShortcutsProvider {4 static var appShortcuts: [AppShortcut] {5 AppShortcut(6 intent: CheckOrderStatusIntent(),7 phrases: [8 "Siparis durumumu \(.applicationName) ile kontrol et",9 "\(.applicationName) siparisim nerede",10 "Son siparisimi \(.applicationName) ile goster"11 ],12 shortTitle: "Siparis Durumu",13 systemImageName: "shippingbox"14 )15 16 AppShortcut(17 intent: OpenArticleIntent(),18 phrases: [19 "\(.applicationName) ile makale oku",20 "\(.applicationName) son makaleleri goster"21 ],22 shortTitle: "Makale Oku",23 systemImageName: "doc.text"24 )25 }26}7. Siri Domains
SiriKit, belirli domain'ler icin hazir intent'ler sunar:
Domain | Ornek Komutlar | Kullanim Alani |
|---|---|---|
Messaging | "Mesaj gonder" | Chat uygulamalari |
Payments | "Para gonder" | Fintech |
Ride Booking | "Taksi cagir" | Ulasim |
Workouts | "Kosu baslat" | Fitness |
Media | "Muzik cal" | Medya oynatici |
Restaurant | "Rezervasyon yap" | Yemek |
Photos | "Fotograf ara" | Galeri |
Lists/Notes | "Not ekle" | Verimlilik |
8. Voice Interaction UX Tasarimi
Sesli etkilesim tasarlarken dikkat edilmesi gerekenler:
- Kisa ve net dialoglar: Siri'nin cevaplari 1-2 cumle olmali
- Confirmation: Kritik islemler icin onay isteyin
- Error handling: Anlasilmayan komutlar icin yonlendirme
- Disambiguation: Belirsiz parametreler icin secenekler sunun
- Progressive disclosure: Basit baslayip detay ekleyin
9. Testing ve Debugging
Siri entegrasyonunu test etmek icin:
- Simulator'da Siri test edebilirsiniz (Type to Siri)
- Shortcuts uygulamasinda intent'lerinizi test edin
- Console.app ile Siri loglarini izleyin
- XCTest ile intent unit test'leri yazin
ALTIN İPUCU
Bu yazının en değerli bilgisi
Bu ipucu, yazının en önemli çıkarımını içeriyor.
Okuyucu Ödülü
Tebrikler! Bu yazıyı sonuna kadar okuduğun için sana özel bir hediyem var:
12. Sonuc ve Oneriler
Sesli asistan entegrasyonu, uygulamanizi kullanicilarin hayatinin dogal bir parcasi haline getirir. App Intents ile baslayarak minimal kodla guclu Siri, Shortcuts ve Spotlight entegrasyonu elde edebilirsiniz. Her intent icin coklu phrase tanimlayin, iyi error handling yapin ve kullanici deneyimini sesli etkilesim icin optimize edin. Gelecekte ses arayuzleri daha da onem kazanacak — simdi yatirim yapmanin tam zamani.

