Add ChatGPT SwiftUI App Stream Cancellation | Swift Task Concurrency

Опубликовано: 16 Октябрь 2024
на канале: Xcoding with Alfian
1,051
37

In this video, we're going to add Cancel Streaming Response to the ChatGPT iOS App using Swift Task Concurrency Cancellation. This is a continuation of the previous tutorials in "Build SwiftUI ChatGPT series"
#swiftui #chatgpt #iosdevelopment #iosdevelopment

Tutorial Links:

Starter Project:
https://github.com/alfianlosari/ChatG...

Completed Project commit diff changes:
https://github.com/alfianlosari/ChatG...

Build SwiftUI ChatGPT series Playlist:
   • Build ChatGPT SwiftUI Multiplatform A...  

Apple Swift Concurrency Documentation:
https://docs.swift.org/swift-book/doc...

Timeline:

00:00:00 Intro
00:01:17 Understanding Task Cancellation in Swift
00:02:55 Update ChatGPTAPI to support Task Cancellation Propagation
00:09:13 Update ViewModel to store Task and add cancel stream method
00:17:48 Add Stop Streaming Button to Content View
00:19:34 Testing the App & Closing


On My Way by Ghostrifter Official |   / ghostrifter-official  
Music promoted by https://www.chosic.com/free-music/all/
Creative Commons CC BY-SA 3.0
https://creativecommons.org/licenses/...