Question: Using LLMRunner Outside of SwiftUI Views in VIPER Architecture #93
-
What Stanford Spezi module is your challenge related to?SpeziLLM DescriptionThank you for creating and maintaining the SpeziLLM repository, it’s been a valuable addition to the iOS app I’m developing. I’m currently in the process of integrating LLMRunner into my app, which follows the VIPER architecture. I had a quick question regarding its usage: At the moment, it appears that the LLM logic is tightly coupled with SwiftUI-specific mechanisms. Any guidance or suggestions on how to decouple this logic from the view layer would be greatly appreciated! ReproductionNot applicable, this is not a bug report. Expected behaviorThe goal is to initialize LLMRunner and LLMLocalSession directly, without relying on SwiftUI constructs such as @Environment or AppDelegate configuration. This would allow the LLM functionality to be cleanly integrated into a repository or Interactor class. Additional contextN/A Code of Conduct
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
@philippzagar Might be the best person to answer this question. |
Beta Was this translation helpful? Give feedback.
-
Hey @AdnanZahid, Thank you for reaching out and for exploring SpeziLLM! We’re excited to hear you’re considering it for your application 🚀 Unfortunately, I am not deeply familiar with the VIPER architecture and have not used it personally in any projects. In contrast, the broader Stanford Spezi ecosystem (including SpeziLLM) is built heavily around SwiftUI-style dependency injection, primarily leveraging the SwiftUI While I cannot comment directly on the VIPER data flow specifics, you would likely still need to find a way to pass the For a more concrete example of how SpeziLLM is used in a real-world application, feel free to explore LLMonFHIR, particularly the Please let us know how you plan to move forward or if you need any additional guidance. We’re happy to help. |
Beta Was this translation helpful? Give feedback.
Hey @AdnanZahid,
Thank you for reaching out and for exploring SpeziLLM! We’re excited to hear you’re considering it for your application 🚀
Unfortunately, I am not deeply familiar with the VIPER architecture and have not used it personally in any projects.
In contrast, the broader Stanford Spezi ecosystem (including SpeziLLM) is built heavily around SwiftUI-style dependency injection, primarily leveraging the SwiftUI
Environment
. Building on this, Spezi introduces abstractions such asModule
s (documentation here), which can declare interdependencies using the@Dependency
property wrapper (reference). These modules integrate seamlessly with SwiftUIView
s, as shown in the Interactions with S…