feat: add SettablePlugin protocol to unify plugin settings#276
feat: add SettablePlugin protocol to unify plugin settings#276
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughA new SettablePlugin protocol and discoverable witness standardize plugin settings: plugins now expose a settingsView(), have a Settings associated type and storage ID, and gain loadSettings()/saveSettings() persistence. Existing per-plugin optionsView()/settings hooks were removed in favor of this unified pathway. Changes
Sequence Diagram(s)sequenceDiagram
participant UI as "TablePro UI"
participant Plugin as "Plugin (SettablePlugin)"
participant Storage as "PluginSettingsStorage\n(UserDefaults JSON)"
rect rgba(200,230,255,0.5)
UI->>Plugin: instantiate plugin (required init)
Plugin->>Storage: loadSettings() → read JSON for settingsStorageId
Storage-->>Plugin: saved Settings? (decoded JSON)
Plugin-->>UI: settingsView() (AnyView?) rendered in dialog
end
rect rgba(200,255,200,0.5)
UI->>Plugin: user updates settings via settingsView
Plugin-->>Plugin: settings property = newValue (didSet)
Plugin->>Storage: saveSettings() → encode & write JSON
Storage-->>Plugin: OK
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment |
Summary
SettablePluginprotocol to TableProPluginKit SDK withSettablePluginDiscoverabletype-erased witness for runtime discoveryas?casts in InstalledPluginsView with singleas? any SettablePluginDiscoverableoptionsView()from ExportFormatPlugin/ImportFormatPlugin andsettingsView()from DriverPlugin protocols (now provided by SettablePlugin conformance)Test plan
xcodebuild -configuration Debug build)swiftlint lint --strictpasses on all changed files (0 violations)PluginSettingsStorageTestspass (8/8)Summary by CodeRabbit
New Features
Improvements