# LYPod **Repository Path**: lypod/LYPod ## Basic Information - **Project Name**: LYPod - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-11-16 - **Last Updated**: 2026-11-16 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # LYPod 跨 App 共用的 iOS **基础层**:主题、导航、网络管线、加密、通用 UI 与工具。 采用 **YYKit 式 subspec**:默认装 **页面展示** 所需模块(Core + Appearance + Navigation);网络 / 加密 / LivePhoto 等按需加;全家桶用 `LYPod/Full`。 > **设计目标**:通用 UI / 主题 / 网络管线 / 加密;环境域名与密钥由同仓 `AppServer`(`AppConstants.swift`)提供。模糊缩略图等业务工具留在主工程。 --- ## 安装(CocoaPods / SPM) 仓库: ### CocoaPods(按需 / 全量) ```ruby # Podfile platform :ios, '15.0' use_frameworks! target 'YourApp' do # 远程 # pod 'LYPod', :git => 'https://gitee.com/lypod/LYPod.git', :tag => '1.0.0' # pod 'LYPod/Full', :git => 'https://gitee.com/lypod/LYPod.git', :tag => '1.0.0' # 本地 path pod 'LYPod', :path => '../LocalPod/LYPod' # pod 'LYPod/Network', :path => '../LocalPod/LYPod' # pod 'LYPod/Full', :path => '../LocalPod/LYPod' end ``` ```bash pod install ``` ### Swift Package Manager SPM 产物对齐 CocoaPods `LYPod/Full`(另导出 `LYAppConfig`): ```swift dependencies: [ .package(url: "https://gitee.com/lypod/LYPod.git", from: "1.0.0") ] ``` ```swift import LYPod import LYAppConfig ``` --- ## Subspec 一览 | Subspec | 内容 | 依赖 | |---------|------|------| | **Core**(默认) | `LYKit`、`MyLog`、本地化、资源 Bundle | — | | **Appearance**(默认) | `ThemeManager`、Nav/Tab/全局 Appearance | Core | | **Navigation**(默认) | `CustomNavigationController`、`GradientNavBar` | Appearance、SnapKit | | **Extensions** | UIKit 扩展、DifferenceKit、ProgressHUD+ | Core、Appearance、Utils、Diff/KF… | | **Utils** | `AppCurrency`、Cache(内存 / 加密磁盘)、`MediaURLResolver`(轻量,无 KTV/Photos) | Core | | **Utils/Toast** | `Toast`(引入时自动带上父 Utils) | Appearance | | **Utils/VideoCache** | `VideoCacheManager`(KTVHTTPCache) | — | | **Utils/LivePhoto** | `LivePhotoAnimatedConverter`(Live→GIF) | Photos… | | **Network** | `NetworkManager`、Models(加解密走 `LYAppConfig`,无密钥明文) | Core、Utils、LYAppConfig、Alamofire… | | **Components** | 空态、弹窗、表单、徽章、媒体预览、Overlay | Appearance、Extensions、Utils、Utils/VideoCache… | | **Full** | 以上全部 + IQKeyboard(Core/Appearance/Resign,无 Toolbar) | — | ### 依赖示意 ``` Core ├─ Appearance → Navigation ├─ Utils ─┬─ Utils/Toast │ ├─ Utils/VideoCache │ └─ Utils/LivePhoto ├─ Extensions (→ Utils) └─ Network (→ Utils + LYAppConfig) └─ Components (→ Extensions + Utils + Utils/VideoCache) Full = 全部模块 ``` --- ## 环境与网络 域名、ClientID、Origin 由宿主注入 `LYPodEnv`;RSA 密钥与加解密在 `LYAppConfig`(无公钥则 `NetworkManager` 明文)。 ```swift import LYPod import LYAppConfig // 需要直接用 RSAEncryption / AESEncryption 时再导 Theme.apply() ``` --- ## 与主工程的边界 | 放在 LYPod | 留在 App / LYAppConfig | |------------|----------| | 通用 UI / 主题 / 网络管线 | 业务 VC、聊天菜单、礼物权限 | | `LYPodEnv`(宿主注入环境值) | `LYAppConfig`(域名/ClientID/RSA/加解密)、PayPal 等 | | `MediaURLResolver`、Live→GIF | 模糊缩略图等业务工具 | | 空态图、通用文案(LYPod.bundle) | 产品专属文案与切图 | --- ## Cache(Utils) | API | 用途 | |-----|------| | `LYCache` | 磁盘:`save` / `load` / `remove` / `removeAll`;`encrypted` → AES-GCM(密钥在 Caches,不进 Keychain) | | `LYMemoryCache` | 会话内存:命中 / inFlight 合并 / `forceRefresh` | ```swift LYCache.save(records, key: "home_videos_page1") LYCache.save(big, key: "xxx", encrypted: true) let cached = LYCache.load([Item].self, key: "home_videos_page1") // 全局:accountScoped: false let mem = LYMemoryCache() mem.load(key: "k", fetch: { finish in … }, completion: { … }) ``` `LYCache.accountIDProvider` 由 `AccountManager` 注入。 --- ## 目录结构 ``` LYPod/ ├── Core/ ├── Appearance/ ├── Navigation/ ├── Extensions/ ├── Utils/ # Cache / AppCurrency / Toast / VideoCache / LivePhoto… ├── Services/ # NetworkManager → Network subspec ├── Models/ # → Network subspec ├── Components/ └── Assets/ ``` 对应:`LocalPod/LYPod.podspec`。 --- ## 版本 - iOS **15.0+** · Swift **5** · `static_framework = true`