<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>应用架构 on LYon's Blog</title><link>https://yindongliang.com/docs/Apple/%E5%BA%94%E7%94%A8%E6%9E%B6%E6%9E%84/</link><description>Recent content in 应用架构 on LYon's Blog</description><generator>Hugo</generator><language>zh-cn</language><atom:link href="https://yindongliang.com/docs/Apple/%E5%BA%94%E7%94%A8%E6%9E%B6%E6%9E%84/index.xml" rel="self" type="application/rss+xml"/><item><title>ViewModel 和 Context 概念</title><link>https://yindongliang.com/docs/Apple/%E5%BA%94%E7%94%A8%E6%9E%B6%E6%9E%84/viewmodel-%E5%92%8C-context/</link><pubDate>Wed, 07 May 2025 00:00:00 +0000</pubDate><guid>https://yindongliang.com/docs/Apple/%E5%BA%94%E7%94%A8%E6%9E%B6%E6%9E%84/viewmodel-%E5%92%8C-context/</guid><description>&lt;p>在 iOS Swift 开发中，Context 和 ViewModel 是两个不同层级的概念，它们分别服务于不同的架构模式和代码组织需求。以下是两者的核心区别与联系：&lt;/p>
&lt;hr>
&lt;h2 id="一核心职责对比">一、核心职责对比&lt;a class="anchor" href="#%e4%b8%80%e6%a0%b8%e5%bf%83%e8%81%8c%e8%b4%a3%e5%af%b9%e6%af%94">#&lt;/a>&lt;/h2>
&lt;ol>
&lt;li>​&lt;strong>​Context（上下文）​&lt;/strong>​&lt;br>
• 角色定位：&lt;/li>
&lt;/ol>
&lt;p>Context 是协调不同组件间交互的“中介者”，通常用于管理多个模块（如 Controller、Presenter、ViewModel）之间的通信和生命周期。它的核心目标是解耦组件间的直接依赖，通过统一的协议或路由机制传递消息。&lt;br>
• 功能特性：&lt;/p></description></item><item><title>The Composable Architecture</title><link>https://yindongliang.com/docs/Apple/%E5%BA%94%E7%94%A8%E6%9E%B6%E6%9E%84/The-Composable-Architecture/</link><pubDate>Sat, 08 Mar 2025 00:00:00 +0000</pubDate><guid>https://yindongliang.com/docs/Apple/%E5%BA%94%E7%94%A8%E6%9E%B6%E6%9E%84/The-Composable-Architecture/</guid><description>&lt;p>The Composable Architecture（TCA）是由 Point-Free 团队设计的开源库，专为构建可维护、可测试且模块化的应用程序而生。它结合了&lt;strong>单向数据流&lt;/strong>和&lt;strong>函数式编程&lt;/strong>思想，尤其适配 SwiftUI，但也支持 UIKit 和其他 Apple 平台。以下是对其核心概念、优势及使用方式的全面介绍：&lt;/p></description></item><item><title>SwiftUI VIPER 架构</title><link>https://yindongliang.com/docs/Apple/%E5%BA%94%E7%94%A8%E6%9E%B6%E6%9E%84/SwiftUI-VIPER/</link><pubDate>Fri, 20 Dec 2024 00:00:00 +0000</pubDate><guid>https://yindongliang.com/docs/Apple/%E5%BA%94%E7%94%A8%E6%9E%B6%E6%9E%84/SwiftUI-VIPER/</guid><description>&lt;p>&lt;code>SwiftUI VIPER Architecture&lt;/code> 是一种将 VIPER 架构模式（&lt;strong>View-Interactor-Presenter-Entity-Router&lt;/strong>）应用于 &lt;strong>SwiftUI&lt;/strong> 的开发方式。VIPER 是一种模块化的架构设计模式，其目的是将项目逻辑分离，不同责任模块各司其职，从而提升代码的可维护性、可扩展性和测试能力。&lt;/p></description></item></channel></rss>