Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Move the Demo app from ObservableObject to the Observation framework

オープン
#476 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
45/100
issue の種類
リファクタリング
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
ios, macos, swift

調査の方向性

Start with APIProvidedView.init, where the stores are created, then read ChatStore and ResponsesStore and the list of stores in the issue. Migrate each ObservableObject to @Observable, update view ownership from @StateObject/@ObservedObject to @State/@Bindable, and remove ChatStore.selectedConversationPublisher. The work is done when the listed stores no longer use ObservableObject, store creation happens once, and the Demo builds and runs on iOS 17/macOS 14.

索引モデルが issue の本文から書いたものです。

説明

The Demo app's stores are ObservableObjects. A view that observes one redraws whenever any of its @Published properties changes, whatever the view shows. While a reply streams, ChatStore and ResponsesStore change dozens of times a second, so every view observing them redraws that often too, the app's root included. In one streamed Chats reply (iOS 27 simulator), ChatStore changed 381 times, and APIProvidedView, ContentView, ChatView and the conversation list each redrew 334 times.

With the Observation framework (@Observable), a view redraws only when a property it read changes. The Demo targets iOS 17 and macOS 14, where Observation is available.

The goal is to move the Demo to Observation first, and only then decide whether anything still updates too often and needs pacing. This came up in the review of #475: the conversation list redraws on every streamed change.

Types to move

  • Streaming stores: ChatStore, ResponsesStore
  • Other stores: AssistantStore, FilesStore, ImageStore, MCPToolsStore, MiscStore, SpeechStore, ResponsesSettingsStore
  • View helper: ChatMessagesPacer, which paces the messages handed to ExyteChat's ChatView

Notes

  • Views: @StateObject becomes @State, and @ObservedObject becomes a plain property, or @Bindable where the view needs bindings (ChatView binds $store.conversations and $store.isSendingMessage). Views that only pass a store on, such as ContentView, MiscView and AssistantsView with ChatStore, then no longer redraw when it changes.
  • Creating the stores: APIProvidedView creates them in its init. @StateObject evaluates its initial value once, but @State evaluates it on every init and keeps only the first, and MCPToolsStore starts connecting in its own init. The stores need to be created once some other way.
  • Combine: ChatStore.selectedConversationPublisher is built on $selectedConversationID, which @Observable doesn't provide. Nothing uses it, so it can go.
主要言語
Swift
スター
2.9k
フォーク
519
平均マージ
2日 14時間
マージ済み PR(30日)
8

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

MacPaw/OpenAI のほかの issue

MacPaw/OpenAI の issue をすべて見る

似ている issue

Swift の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。