Compare commits
15
Commits
master
...
c61115cab3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c61115cab3 | ||
|
|
95cead5863 | ||
|
|
68d9363f0a | ||
|
|
52f803e8db | ||
|
|
1422461224 | ||
|
|
a17164d1a9 | ||
|
|
1bde945d36 | ||
|
|
5a19cfde14 | ||
|
|
7c16647306 | ||
|
|
d56e99a83f | ||
|
|
fed34da246 | ||
|
|
72c1f8d89c | ||
|
|
822949f6cc | ||
|
|
6a0a1223b1 | ||
|
|
adc24d3f36 |
@@ -0,0 +1,90 @@
|
|||||||
|
---
|
||||||
|
name: commit-git-changes
|
||||||
|
description: 审查当前 Git 工作区,安全选择本次任务文件,生成包含问题背景、根因和修改方案的详细中文提交说明,并提交及按用户要求推送到 Git 服务器。默认不执行构建或测试;用户要求“提交代码”“提交并推送”“同步到 Git”“上传当前修改”或要求生成详细 commit message 时使用。
|
||||||
|
---
|
||||||
|
|
||||||
|
# 提交 Git 改动
|
||||||
|
|
||||||
|
## 目标
|
||||||
|
|
||||||
|
在不混入无关修改、不泄露敏感信息、不改写远端历史的前提下,完成“审查—暂存—提交—推送—确认”闭环,并用提交说明解释为什么修改以及如何解决,而不只是罗列文件。
|
||||||
|
|
||||||
|
## 工作流
|
||||||
|
|
||||||
|
1. 读取仓库级 `AGENTS.md`、当前分支、远端和工作区状态。
|
||||||
|
2. 检查暂存与未暂存差异:
|
||||||
|
- 使用 `git status --short` 确认全部改动。
|
||||||
|
- 使用 `git diff` 和 `git diff --cached` 理解真实行为变化。
|
||||||
|
- 必要时查看相关源码和测试,不能仅依据文件名编写提交说明。
|
||||||
|
3. 划定本次提交范围:
|
||||||
|
- 只纳入当前用户任务直接相关的文件。
|
||||||
|
- 保留用户已有或其他任务产生的无关修改。
|
||||||
|
- 优先显式 `git add <path...>`;仅在确认所有改动均属本次提交时使用 `git add -A`。
|
||||||
|
- 发现密钥、令牌、证书、个人配置、大型生成物或疑似敏感数据时停止提交并说明。
|
||||||
|
4. 不默认执行构建、测试或项目级验证;仅在用户明确要求时执行。
|
||||||
|
5. 暂存后再次检查:
|
||||||
|
- 执行 `git diff --cached --check`。
|
||||||
|
- 执行 `git diff --cached --stat` 和 `git diff --cached`。
|
||||||
|
- 确认暂存区没有无关文件、调试残留和意外格式变化。
|
||||||
|
6. 编写详细中文提交说明并创建提交。
|
||||||
|
7. 用户要求提交到服务器或同步远端时推送:
|
||||||
|
- 有 upstream 时推送当前分支。
|
||||||
|
- 没有 upstream 且远端、目标分支明确时,使用 `git push -u <remote> <branch>`。
|
||||||
|
- 远端或目标分支不明确时先询问,不猜测。
|
||||||
|
- 禁止 force push;除非用户明确要求且风险已说明。
|
||||||
|
8. 提交后确认提交哈希、提交标题、当前分支、推送结果和剩余未提交改动。
|
||||||
|
|
||||||
|
## 提交说明规范
|
||||||
|
|
||||||
|
提交说明使用“标题 + 空行 + 详细正文”的结构。
|
||||||
|
|
||||||
|
### 标题
|
||||||
|
|
||||||
|
- 用一句中文概括用户可感知的问题和修复结果。
|
||||||
|
- 优先写清触发条件、异常表现和结果,例如:
|
||||||
|
`修复无训练点普通课程完成后重进播放页回退为未完成`
|
||||||
|
- 使用明确动词,如“修复”“新增”“调整”“重构”“移除”。
|
||||||
|
- 不使用“修改代码”“优化问题”“更新若干内容”等空泛描述。
|
||||||
|
- 保持单行,不以句号结尾,不添加无依据的工单号或模块前缀。
|
||||||
|
|
||||||
|
### 正文
|
||||||
|
|
||||||
|
用完整段落解释以下内容:
|
||||||
|
|
||||||
|
1. **问题背景与影响**:什么场景触发、用户看到什么、影响哪些路径。
|
||||||
|
2. **根因**:原有数据流、状态条件或实现约束为什么导致问题。
|
||||||
|
3. **修改方案**:关键行为如何改变,为什么选择该方案,必要时说明兼容和边界处理。
|
||||||
|
|
||||||
|
正文应描述行为和因果关系,不要把 `git diff --stat` 改写成文件清单。多个紧密相关的修改可以分段说明,但不要堆砌逐文件 bullet。
|
||||||
|
|
||||||
|
若用户明确要求并实际执行了构建、测试或其他验证,可以在正文末尾如实补充;未执行时不需要添加“验证:未执行”之类的说明。
|
||||||
|
|
||||||
|
### 示例
|
||||||
|
|
||||||
|
```text
|
||||||
|
修复无训练点普通课程完成后重进播放页回退为未完成
|
||||||
|
|
||||||
|
课件完成态本地记录的保存不区分训练点,但读取端仅在存在
|
||||||
|
trainPointModel 时才创建合并器,导致班级、训练和项目均为空的普通课程
|
||||||
|
重进播放页后无法读取本地完成记录。
|
||||||
|
|
||||||
|
改为始终创建完成态合并器:无训练点时使用空维度合并;由于该场景没有
|
||||||
|
服务端完成态可供对账,将本地记录作为唯一持久来源并跳过超期回收,保持
|
||||||
|
重新进入播放页后的完成状态稳定。
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
根据真实改动改写示例内容,禁止照抄未发生的场景或验证结论。
|
||||||
|
|
||||||
|
## 提交与推送约束
|
||||||
|
|
||||||
|
- 不使用 `git reset --hard`、`git checkout --`、`git clean` 等破坏性命令处理工作区。
|
||||||
|
- 不使用 `--amend`、rebase、历史改写或强制推送,除非用户明确授权。
|
||||||
|
- 不跳过 hooks;hook 失败时先分析原因,不使用 `--no-verify` 绕过。
|
||||||
|
- 提交失败后保留暂存区,修复可控问题并重试;不要重复创建等价提交。
|
||||||
|
- 推送被拒绝时先获取并解释分支差异,不自动合并、变基或覆盖远端。
|
||||||
|
- 若没有可提交差异,直接说明,不创建空提交。
|
||||||
|
|
||||||
|
## 交付
|
||||||
|
|
||||||
|
报告提交哈希和标题、推送的远端分支,以及仍留在工作区的未提交修改。若只完成本地提交而未推送,必须明确说明。
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
interface:
|
||||||
|
display_name: "提交 Git 代码"
|
||||||
|
short_description: "安全审查改动并生成详细中文说明,完成 Git 提交与远端推送"
|
||||||
|
default_prompt: "使用 $commit-git-changes 审查当前改动,生成详细中文提交说明并提交到 Git 服务器。"
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
---
|
||||||
|
name: discuss-sdk-feature-solution
|
||||||
|
description: 讨论 ReadViewSDK 的新功能、修复或重构方案,核验 EPUB/PDF 阅读器源码,比较实现路径并收敛为可直接开发的计划。用户说“先讨论”“先给方案”“比较方案”“不要改代码”,或接口、缓存、渲染路径、持久化兼容存在会改变实现方式的灰区时使用;路径已明确且用户要求直接修改时不要使用。
|
||||||
|
---
|
||||||
|
|
||||||
|
# SDK 功能方案讨论
|
||||||
|
|
||||||
|
## 目标
|
||||||
|
|
||||||
|
在编码前用仓库事实收敛决策,输出最小、可验证、能交给开发 Skill 直接执行的方案。本 Skill 默认不修改业务代码。
|
||||||
|
|
||||||
|
## 工作流
|
||||||
|
|
||||||
|
1. 检查工作区并定位目标模块、入口、相邻实现和对应文档。
|
||||||
|
2. 区分已锁定决定、阻塞决定、实现假设、后续项与非范围。
|
||||||
|
3. 按根目录 `AGENTS.md` 读取所需文档;结论必须由真实路径、类型、方法和调用链支撑。
|
||||||
|
4. 方案未定时给出 2–4 个可行路径,比较改动面、公开 API、缓存/持久化、渲染路径、性能、回归和维护成本,并明确推荐一个。
|
||||||
|
5. 用户已选定方案时只细化该方案,不继续横向发散。
|
||||||
|
6. 方案至少覆盖:
|
||||||
|
- EPUB:`.textReflowable`、`.webInteractive`、`.webFixedLayout` 中受影响的路径
|
||||||
|
- PDF:宿主图片 Provider 与内置 PDFKit Provider 中受影响的路径
|
||||||
|
- 公共 API、Codable/磁盘格式、缓存版本和 CocoaPods 集成影响
|
||||||
|
- 异步乱序、取消、生命周期、内存压力和失败降级
|
||||||
|
7. 收敛为文件级任务、数据/状态流、成功标准、验证方式、风险和回滚点。
|
||||||
|
|
||||||
|
## 输出
|
||||||
|
|
||||||
|
默认在对话中给出:
|
||||||
|
|
||||||
|
- 需求、范围与非范围
|
||||||
|
- 已确认决定、阻塞项和必要假设
|
||||||
|
- 方案对比或已选方案拆解
|
||||||
|
- 涉及文件、调用链、复用点和兼容策略
|
||||||
|
- 风险、回滚点与验证清单
|
||||||
|
- 建议交给 `start-sdk-feature-dev-lite` 或 `start-sdk-feature-dev` 的执行摘要
|
||||||
|
|
||||||
|
用户要求落文档,或方案需要跨会话执行时,写入 `Doc/FeatureSolution/`,并在存在文档索引时同步 `Doc/index.md`。
|
||||||
|
|
||||||
|
## 边界
|
||||||
|
|
||||||
|
- 不为未确认的未来需求预埋抽象。
|
||||||
|
- 必要改动、可选优化和后续治理必须分开。
|
||||||
|
- 未核验的系统 API、第三方能力、文件格式或缓存行为不得写成事实。
|
||||||
|
- 文档与源码冲突时以当前源码为事实,并明确指出文档待同步项。
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
interface:
|
||||||
|
display_name: "SDK 功能方案讨论"
|
||||||
|
short_description: "核验当前仓库事实,比较实现路径并输出可直接开发的完整方案"
|
||||||
|
default_prompt: "Use $discuss-sdk-feature-solution to compare implementation paths and produce an executable handoff."
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
---
|
||||||
|
name: generate-module-code-style-doc
|
||||||
|
description: 基于真实源码生成或更新 ReadViewSDK 指定模块的代码组织、命名、分层、UI、状态、缓存和复用规范,适用于 EPUBCore、EPUBTextRendering、ReaderView、EPUBUI、RDPDFReaderView 或 Demo。全局规范使用 generate-sdk-code-style-doc。
|
||||||
|
---
|
||||||
|
|
||||||
|
# 生成模块代码规范
|
||||||
|
|
||||||
|
## 工作流
|
||||||
|
|
||||||
|
1. 确定目标模块、关注范围和输出文件;优先增量更新 `Doc/` 中现有对应文档。
|
||||||
|
2. 读取目标模块源码、对应 code reference、`Doc/CONVENTIONS.md` 和必要架构章节。
|
||||||
|
3. 抽样入口、协议、模型、View/Cell、Controller、Coordinator/Service、缓存和 Extension;不存在的层级不要补造。
|
||||||
|
4. 提炼真实且重复出现的模式,并区分当前约定、特殊例外及原因、尚未落地的建议。
|
||||||
|
5. 记录目录职责、命名、可见性、依赖方向、状态管理、布局、回调、缓存、失败处理、公共 API 和跨模块边界。
|
||||||
|
6. 对 EPUB 模块说明适用的渲染路径;对 PDF 模块说明自定义 Provider 与 PDFKit 路径差异。
|
||||||
|
7. 增量更新文档,检查与全局规范、podspec、架构和源码是否冲突。
|
||||||
|
8. 文档新增、移动或重命名时同步 `Doc/index.md`。
|
||||||
|
|
||||||
|
## 边界
|
||||||
|
|
||||||
|
- 只描述目标模块,不把局部模式提升为全局事实。
|
||||||
|
- 不虚构理想分层、协议或不存在的调用链。
|
||||||
|
- 默认不修改业务代码;发现问题时作为建议或 finding 单独列出。
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
interface:
|
||||||
|
display_name: "生成模块代码规范"
|
||||||
|
short_description: "基于真实源码生成指定 EPUB、PDF 或 Demo 模块的局部规范文档"
|
||||||
|
default_prompt: "Use $generate-module-code-style-doc to document the coding patterns of this ReadViewSDK module."
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
---
|
||||||
|
name: generate-module-implementation-logic
|
||||||
|
description: 从 ReadViewSDK 真实源码生成或更新指定模块或场景的入口、调用链、数据流、状态流、渲染流、缓存、持久化、异步回调和异常分支文档。用户要求梳理实现逻辑、调用链、分页或缓存流程时使用;代码风格规范改用对应 code-style Skill。
|
||||||
|
---
|
||||||
|
|
||||||
|
# 生成模块实现逻辑
|
||||||
|
|
||||||
|
## 工作流
|
||||||
|
|
||||||
|
1. 确定目标模块、用户场景和输出路径;优先复用 `Doc/` 中现有专题或 code reference。
|
||||||
|
2. 读取目标入口、现有文档,以及 `AGENTS.md` 路由出的架构、API 或测试资料。
|
||||||
|
3. 用引用搜索沿真实关系追踪:
|
||||||
|
- 页面、控制器、协议或服务入口及触发条件
|
||||||
|
- 数据模型、状态所有者和线程/队列
|
||||||
|
- EPUB 解析/排版/分页/章节窗口,或 PDF Provider/渲染/OCR/标注
|
||||||
|
- 内存与磁盘缓存、键、版本、驱逐和恢复
|
||||||
|
- 通知、回调、delegate、持久化和跨模块依赖
|
||||||
|
- 空值、失败、取消、重试、超时、迟到结果和兼容分支
|
||||||
|
4. 对关键链路至少双向核验一次:从入口跟到结果,再从结果或回调查回调用方。
|
||||||
|
5. 区分当前实现、历史兼容层、仅文档中的计划和待确认事实。
|
||||||
|
6. 增量更新文档,保留正确内容,删除或标记失效链路。
|
||||||
|
7. 结论引用真实文件、类型和方法;不确定信息明确标为待确认。
|
||||||
|
8. 文档新增、移动或重命名时同步 `Doc/index.md`。
|
||||||
|
|
||||||
|
## 推荐结构
|
||||||
|
|
||||||
|
- 适用范围与模块职责
|
||||||
|
- 入口和主要对象
|
||||||
|
- 主流程与数据/状态/渲染变化
|
||||||
|
- 缓存、持久化和并发模型
|
||||||
|
- 异常、取消、重试和兼容处理
|
||||||
|
- 维护风险与验证要点
|
||||||
|
|
||||||
|
纯文档任务不修改业务代码;源码暴露的缺陷应单独报告,不把建议写成已实现事实。
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
interface:
|
||||||
|
display_name: "生成模块实现逻辑"
|
||||||
|
short_description: "梳理指定阅读器模块的入口、调用链、状态流、缓存及异常分支"
|
||||||
|
default_prompt: "Use $generate-module-implementation-logic to document this module's verified implementation flow."
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
---
|
||||||
|
name: generate-sdk-code-style-doc
|
||||||
|
description: 基于 ReadViewSDK 当前 EPUB、PDF 和 Demo 源码生成或更新全局代码规范、目录职责、命名、分层、UIKit/SnapKit、并发、缓存、公共 API 与测试约定。用户要求项目级编码规范或更新 Doc/CONVENTIONS.md 时使用;单模块规范改用 generate-module-code-style-doc。
|
||||||
|
---
|
||||||
|
|
||||||
|
# 生成 SDK 全局代码规范
|
||||||
|
|
||||||
|
## 工作流
|
||||||
|
|
||||||
|
1. 明确输出路径;未指定时增量更新 `Doc/CONVENTIONS.md`。
|
||||||
|
2. 读取现有目标文档、`Doc/ARCHITECTURE.md`、`Doc/index.md` 和两个 podspec。
|
||||||
|
3. 从 EPUBCore、EPUBTextRendering、ReaderView、EPUBUI、RDPDFReaderView 与 Demo/UITests 抽样真实源码。
|
||||||
|
4. 把结论分为:
|
||||||
|
- 多模块源码验证的现行约定
|
||||||
|
- 仅适用于 EPUB、PDF 或 Demo 的局部模式
|
||||||
|
- 明确标记为建议、尚未成为项目事实的待统一项
|
||||||
|
5. 覆盖目录职责、命名与可见性、公共 API、UIKit/SnapKit、异步与取消、缓存/持久化、错误处理、测试、注释和 CocoaPods 约定。
|
||||||
|
6. 增量保留仍正确内容,删除失效描述;使用真实路径、类型和方法作为证据。
|
||||||
|
7. 新增、移动或重命名文档时同步 `Doc/index.md`,最后检查链接和源码一致性。
|
||||||
|
|
||||||
|
## 边界
|
||||||
|
|
||||||
|
- 不把 EPUB 的局部模式提升为 PDF 的全局规范,反之亦然。
|
||||||
|
- 不以旧 `.claude/skills` 或过期文档替代当前源码事实。
|
||||||
|
- 不把个人偏好写成现行规范。
|
||||||
|
- 文档任务默认不修改业务代码;发现缺陷时单独报告。
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
interface:
|
||||||
|
display_name: "生成 SDK 全局规范"
|
||||||
|
short_description: "从当前 EPUB 与 PDF 源码证据生成或更新项目级代码规范文档"
|
||||||
|
default_prompt: "Use $generate-sdk-code-style-doc to update the project-wide coding conventions from source evidence."
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
---
|
||||||
|
name: review-swift-ios-sdk
|
||||||
|
description: 对 ReadViewSDK 的 Swift/iOS 代码进行专项审查,覆盖并发、主线程、生命周期、内存、缓存、渲染性能、可访问性、安全、公共 API 和持久化兼容。用户要求继续检查隐藏问题、代码审查、性能或内存审计时使用;普通功能开发和纯文档任务不要单独使用。
|
||||||
|
---
|
||||||
|
|
||||||
|
# Swift/iOS SDK 专项审查
|
||||||
|
|
||||||
|
## 工作流
|
||||||
|
|
||||||
|
1. 明确审查范围和修改授权;只要求审查时不得修改代码。
|
||||||
|
2. 检查工作区和最近改动,读取目标代码、相邻实现及 `AGENTS.md` 路由出的文档。
|
||||||
|
3. 沿入口、异步回调、持久化和渲染结果双向追踪,不只检查单个函数。
|
||||||
|
4. 仅报告能由当前源码证明、可触发且值得行动的问题。
|
||||||
|
|
||||||
|
## 检查维度
|
||||||
|
|
||||||
|
### 并发与生命周期
|
||||||
|
|
||||||
|
- UI 是否回到主线程,迟到结果是否会覆盖新状态。
|
||||||
|
- token、重试、超时和取消是否保证恰好一次完成。
|
||||||
|
- 闭包、Task、通知、定时器、观察者、WKWebView 和 Vision 请求是否释放。
|
||||||
|
- PDFKit、缓存字典和持久化文件是否在正确队列或锁内访问。
|
||||||
|
|
||||||
|
### 性能与内存
|
||||||
|
|
||||||
|
- 滚动、缩放、绘画和分页热点是否包含同步 IO、重复解码或重复排版。
|
||||||
|
- EPUB 章节窗口、页图缓存、PDF 页面位图和绘画缓存是否有明确边界。
|
||||||
|
- 内存警告后可见内容能否恢复,驱逐后迟到回调是否重新撑大缓存。
|
||||||
|
- 图片像素成本、NSCache 限额、autoreleasepool 和大对象生命周期是否合理。
|
||||||
|
|
||||||
|
### SDK 兼容性
|
||||||
|
|
||||||
|
- `public` API、协议要求、初始化方法和默认行为是否意外 breaking。
|
||||||
|
- Codable、文件名、缓存键、book identifier 和 schema version 是否可迁移。
|
||||||
|
- EPUB 三种渲染路径和 PDF 两种 Provider 路径是否行为一致。
|
||||||
|
- podspec 是否包含新增源码、资源、系统 framework 和依赖。
|
||||||
|
|
||||||
|
### 交互、安全与可访问性
|
||||||
|
|
||||||
|
- 缩放锚点、Cell 复用、双页布局、手势竞争和绘画图层是否稳定。
|
||||||
|
- 图标按钮、自定义控件、动态字体和 VoiceOver 语义是否完整。
|
||||||
|
- 日志、文件路径和错误信息是否泄露敏感数据。
|
||||||
|
|
||||||
|
## 输出
|
||||||
|
|
||||||
|
按严重程度列出 findings;每条包含位置、触发条件、用户影响、根因和最小修复建议。没有发现问题时明确说明,并列出尚未覆盖的运行时验证空白。
|
||||||
|
|
||||||
|
若用户同时要求修改,沿用对应开发 Skill 的实现、验证和交付规则。
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
interface:
|
||||||
|
display_name: "Swift/iOS SDK 专项审查"
|
||||||
|
short_description: "审查并发、生命周期、性能、内存及公开 API 风险"
|
||||||
|
default_prompt: "Use $review-swift-ios-sdk to audit this ReadViewSDK code for iOS-specific risks."
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
---
|
||||||
|
name: start-sdk-feature-dev-lite
|
||||||
|
description: 实现 ReadViewSDK 的单模块功能、Bug 修复、UI 调整、局部重构、编译修复或小范围 CocoaPods 变更,并完成必要验证。作为默认开发入口;跨 EPUB/PDF 模块、改变公共协议或持久化格式、需要迁移回滚或严格执行完整方案时使用 start-sdk-feature-dev。
|
||||||
|
---
|
||||||
|
|
||||||
|
# SDK 轻量开发
|
||||||
|
|
||||||
|
## 目标
|
||||||
|
|
||||||
|
用最小改动完成边界清晰的任务,形成“实现—验证—交付”闭环。
|
||||||
|
|
||||||
|
## 工作流
|
||||||
|
|
||||||
|
1. 检查工作区,识别并保留用户已有修改。
|
||||||
|
2. 定位目标源码、现有相邻模式和 `AGENTS.md` 路由出的文档。
|
||||||
|
3. 若用户提供方案,完整读取并执行已锁定决定;源码事实使方案不可行时先说明冲突。
|
||||||
|
4. 明确 In Scope、Out of Scope、成功标准和短执行清单。
|
||||||
|
5. 按模块边界实施最小修改:
|
||||||
|
- EPUB 解析与资源:`Sources/RDEpubReaderView/EPUBCore`
|
||||||
|
- EPUB 文本排版:`Sources/RDEpubReaderView/EPUBTextRendering`
|
||||||
|
- EPUB 翻页容器:`Sources/RDEpubReaderView/ReaderView`
|
||||||
|
- EPUB 成品 UI:`Sources/RDEpubReaderView/EPUBUI`
|
||||||
|
- PDF 阅读器:`Sources/RDPDFReaderView`
|
||||||
|
- 集成与回归入口:`ReadViewDemo`
|
||||||
|
6. 自检空值、失败分支、异步乱序、取消语义、主线程、生命周期、Cell 复用、缓存边界、内存警告和可访问性。
|
||||||
|
7. 检查公共 API、持久化模型、缓存键/版本、资源路径及 podspec 是否被意外改变。
|
||||||
|
8. 按风险执行构建或定向 UI 测试;编译错误应修复并重试。
|
||||||
|
9. 代码行为显著变化时更新最接近的 `Doc/` 文档。
|
||||||
|
|
||||||
|
## 升级条件
|
||||||
|
|
||||||
|
出现以下任一情况时切换到 `start-sdk-feature-dev` 并说明:
|
||||||
|
|
||||||
|
- 同时改变 EPUB 与 PDF 阅读器,或改变多个 EPUB 层级的职责。
|
||||||
|
- 修改宿主可见协议、公共初始化方法或需要兼容迁移。
|
||||||
|
- 改变持久化格式、缓存架构、分页主流程或跨模块状态流。
|
||||||
|
- 用户要求逐项执行完整开发方案。
|
||||||
|
|
||||||
|
## 交付
|
||||||
|
|
||||||
|
最终简洁说明完成内容、关键取舍、主要文件、验证结果、未覆盖风险和同步文档;不强制套固定模板。
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
interface:
|
||||||
|
display_name: "SDK 轻量开发"
|
||||||
|
short_description: "完成局部功能、Bug 修复、小范围重构及对应构建验证闭环"
|
||||||
|
default_prompt: "Use $start-sdk-feature-dev-lite to implement this scoped ReadViewSDK change and verify it."
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
---
|
||||||
|
name: start-sdk-feature-dev
|
||||||
|
description: 实现 ReadViewSDK 的跨层或跨阅读器改造、分页/缓存/持久化系统性重构、公共 API 演进、复杂联调,或严格执行用户提供的完整方案文档。单模块功能、UI 微调、Bug 修复和局部改动优先使用 start-sdk-feature-dev-lite。
|
||||||
|
---
|
||||||
|
|
||||||
|
# SDK 完整开发
|
||||||
|
|
||||||
|
## 目标
|
||||||
|
|
||||||
|
对复杂任务建立可追溯计划,控制接口兼容、依赖、迁移和回滚风险,完成实现、联调、验证与文档同步。
|
||||||
|
|
||||||
|
## 工作流
|
||||||
|
|
||||||
|
1. 检查工作区,区分本任务改动和用户已有改动。
|
||||||
|
2. 明确主改动模块、受影响模块、In Scope、Out of Scope、联调依赖和完成标准。
|
||||||
|
3. 按 `AGENTS.md` 读取架构、公共 API、目标子系统和测试文档,并用源码复核。
|
||||||
|
4. 用户提供方案时:
|
||||||
|
- 完整读取并提取锁定决定、任务清单、文件清单、限制和验收标准。
|
||||||
|
- 逐项执行,不自行替换技术路径、数据模型或文件布局。
|
||||||
|
- 方案与源码冲突时暂停,说明影响和最小修订建议。
|
||||||
|
5. 没有方案时制定最小可落地计划,明确执行顺序、数据/状态流、风险、回滚点和验证。
|
||||||
|
6. 实施时区分计划内修改、不可避免的“必要补齐”和可选后续项;会改变方案的偏差先确认。
|
||||||
|
7. 做跨模块自检:
|
||||||
|
- EPUB 四层依赖方向和三种渲染路径
|
||||||
|
- PDF 自定义 Provider 与 PDFKit 直读路径
|
||||||
|
- 公共 API 的源码兼容与行为兼容
|
||||||
|
- Codable/磁盘格式迁移、缓存键、版本和失效策略
|
||||||
|
- 异步 token、取消、迟到回调、主线程和生命周期
|
||||||
|
- 大图、排版产物、章节窗口和内存警告处理
|
||||||
|
- CocoaPods source/resource/framework 配置和 Demo 集成
|
||||||
|
8. 同步架构、API、子系统或测试文档;文档新增或移动时更新索引。
|
||||||
|
9. 执行构建和与风险相称的定向回归,记录无法自动覆盖的联调项。
|
||||||
|
|
||||||
|
## 方案控制
|
||||||
|
|
||||||
|
- 用户确认的方案不能被“更简单的建议”静默覆盖。
|
||||||
|
- 不以顺手治理为由扩大重构范围。
|
||||||
|
- 涉及线上数据、缓存迁移或公共 API 时必须写明兼容、回滚或降级方式。
|
||||||
|
- 新增依赖、资源或公开类型前必须确认 podspec 和宿主集成影响。
|
||||||
|
|
||||||
|
## 交付
|
||||||
|
|
||||||
|
最终说明范围和计划完成情况、关键实现与偏差、改动模块、构建/测试结果、兼容与回滚策略、未覆盖风险和同步文档。
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
interface:
|
||||||
|
display_name: "SDK 完整开发"
|
||||||
|
short_description: "执行跨阅读器模块改造、复杂联调、兼容评估与完整验证交付"
|
||||||
|
default_prompt: "Use $start-sdk-feature-dev to implement this cross-module ReadViewSDK plan with full verification."
|
||||||
Symlink
+1
@@ -0,0 +1 @@
|
|||||||
|
../.agents/skills
|
||||||
@@ -1,286 +0,0 @@
|
|||||||
---
|
|
||||||
name: "Discuss SDK Feature Solution"
|
|
||||||
description: "方案讨论优先 skill:用于 ReadViewSDK 新需求的实现方案分析、路径对比、取舍沟通、已定方案细化和实现交接。"
|
|
||||||
argument-hint: "粘贴需求、目标模块、约束、已知备选方案;可附加:是否已确定方案 / 是否需要推荐方案 / 是否需要落方案文档。"
|
|
||||||
---
|
|
||||||
|
|
||||||
# Discuss SDK Feature Solution
|
|
||||||
|
|
||||||
## Purpose
|
|
||||||
|
|
||||||
面向 ReadViewSDK 的"实现方案讨论入口" skill。
|
|
||||||
用于在正式开发前,先把需求、约束、可选实现路径和关键取舍聊透;若方案已经确定,则只围绕已选方案继续细化,再交接给开发 skill 进入实现。
|
|
||||||
|
|
||||||
该 skill 借鉴 spec-driven 工作流思想:讨论阶段专门捕获灰区决策,计划阶段必须经过代码 / 文档事实核验,最终输出能直接喂给开发 skill 的结构化方案文档,避免"聊完还是不能开发"。
|
|
||||||
|
|
||||||
该 skill 的职责固定为:
|
|
||||||
- 先理解需求与约束
|
|
||||||
- 捕获灰区问题和实现假设
|
|
||||||
- 用现有代码 / 文档核验方案可行性
|
|
||||||
- 未定方案时:输出 2-4 个可行实现方案,并做对比
|
|
||||||
- 已定方案时:只围绕确认方案展开实现讨论,不再继续扩展其他方案
|
|
||||||
- 最后给出交接到开发 skill 的明确指令
|
|
||||||
- 最终必须产出一份可直接供开发 skill 使用的开发详细文档,或一段可直接执行的开发详细描述
|
|
||||||
|
|
||||||
## Core Discussion Rules
|
|
||||||
|
|
||||||
- Rule 1 — Think Before Coding
|
|
||||||
- 在提出方案前先核对代码和文档事实,不静默假设
|
|
||||||
- 必须显式写出关键假设、主要取舍和已知风险
|
|
||||||
- 遇到会改变实现路径的关键灰区,先提出并请求确认,不靠猜测补完整个方案
|
|
||||||
- 若存在更简单且满足目标的实现路径,必须主动指出并优先推荐
|
|
||||||
- Rule 2 — Simplicity First
|
|
||||||
- 推荐方案优先选择最小可落地路径,而不是概念上更"完整"的设计
|
|
||||||
- 不为了未来可能性预埋推测性扩展,不为单次使用引入抽象
|
|
||||||
- 若某个方案明显过度设计,必须直接指出并解释为什么不推荐
|
|
||||||
- Rule 3 — Surgical Changes
|
|
||||||
- 方案只覆盖完成当前目标所必需的改动面
|
|
||||||
- 不把无关重构、顺手统一风格或额外治理动作夹带进推荐方案
|
|
||||||
- 若确有相邻改动依赖,必须明确标注"必要改动"与"可选优化"的边界
|
|
||||||
- Rule 4 — Goal-Driven Execution
|
|
||||||
- 讨论输出必须先定义成功标准和验证方式,再给实现交接建议
|
|
||||||
- 不把讨论步骤本身当结果,重点是产出可执行、可验证的方案
|
|
||||||
- 交接给开发 skill 时,必须让对方清楚"做到什么算完成"
|
|
||||||
|
|
||||||
## When To Use
|
|
||||||
|
|
||||||
当用户提出以下类型需求时使用:
|
|
||||||
- "先讨论一下这个需求怎么实现"
|
|
||||||
- "这个功能可能有多种实现方式,先分析方案"
|
|
||||||
- "先别写代码,先帮我想实现路径"
|
|
||||||
- "先比较几种方案,再决定怎么做"
|
|
||||||
|
|
||||||
适用场景:
|
|
||||||
- 同一个需求可以通过多种技术路径实现
|
|
||||||
- 需要权衡 SDK 分层(EPUBCore / EPUBTextRendering / RDReaderView / EPUBUI)、复用、维护成本、回归影响
|
|
||||||
- 需要在实现前先明确推荐方案和待确认细节
|
|
||||||
- 已经明确采用某个方案,但还需要继续细化实现边界、拆解落地路径和交接开发
|
|
||||||
|
|
||||||
不适用场景:
|
|
||||||
- 用户已经明确要直接实现,且实现路径基本单一时,优先使用开发类 skill
|
|
||||||
- 用户只想生成文档,不需要方案讨论时,优先使用文档类 skill
|
|
||||||
|
|
||||||
## Inputs
|
|
||||||
|
|
||||||
推荐输入:
|
|
||||||
- 需求描述
|
|
||||||
- 目标模块或 Feature(属于哪一层:EPUBCore / EPUBTextRendering / RDReaderView / EPUBUI / Legacy)
|
|
||||||
- 已知约束(兼容性、性能、API 兼容、CocoaPods 发布等)
|
|
||||||
- 已有备选方案(如有)
|
|
||||||
- 已确认方案(如已决定)
|
|
||||||
- 是否需要推荐方案
|
|
||||||
- 是否需要最终落方案文档
|
|
||||||
|
|
||||||
若信息不足:
|
|
||||||
- 先通过代码和文档补齐可发现事实
|
|
||||||
- 再围绕真正影响方案选择的灰区进行澄清
|
|
||||||
- 若用户不想继续问答,必须显式列出"实现假设",并把假设写入方案或交接摘要
|
|
||||||
|
|
||||||
若用户已经明确指定"采用方案 X / 就按这个方案做":
|
|
||||||
- 视为进入"已定方案模式"
|
|
||||||
- 后续输出禁止继续罗列其他候选方案、备选实现或横向对比
|
|
||||||
- 仅允许在必要时补充"当前方案的风险、前提、边界和实现细化"
|
|
||||||
|
|
||||||
## Scope / Required Context
|
|
||||||
|
|
||||||
默认先读:
|
|
||||||
1. `Doc/ARCHITECTURE.md` — 四层架构、数据流、分页模式、位置模型、已知限制
|
|
||||||
2. `Doc/CODING_STYLE.md` — 命名规范(RD/RDEPUB 前缀)、分层规则、extension 拆分规则、SS→RD 迁移计划
|
|
||||||
3. `Doc/EPUB_MAINTENANCE.md` — 文件职责表、DTCoreText 渲染管线、常见排查场景
|
|
||||||
|
|
||||||
按需再读:
|
|
||||||
- 涉及 EPUB 解析时:`Sources/RDReaderView/EPUBCore/` 下相关文件
|
|
||||||
- 涉及文本渲染时:`Sources/RDReaderView/EPUBTextRendering/` 下相关文件
|
|
||||||
- 涉及阅读器容器时:`Sources/RDReaderView/RDReaderView.swift` 及同级文件
|
|
||||||
- 涉及 UI 层时:`Sources/RDReaderView/EPUBUI/` 下相关文件
|
|
||||||
- 涉及遗留代码时:`Sources/RDReaderView/LegacyRDReaderController/` 下相关文件
|
|
||||||
- 涉及 JS 桥接时:`Sources/RDReaderView/Resources/epub-bridge.js`
|
|
||||||
|
|
||||||
若文档与代码不一致:
|
|
||||||
- 以代码事实为准做方案讨论
|
|
||||||
- 在推荐方案中指出不一致点和可能影响
|
|
||||||
|
|
||||||
方案文档落地目录约束:
|
|
||||||
- 讨论型方案文档统一落到 `Doc/FeatureSolution/`(若目录不存在则创建)
|
|
||||||
- 不要把方案讨论文档写入其他目录
|
|
||||||
|
|
||||||
## SDK-Specific Discussion Rules
|
|
||||||
|
|
||||||
讨论时必须考虑的 SDK 特有约束:
|
|
||||||
|
|
||||||
- **分层边界**:方案必须明确落在哪一层,不得跨层引入反向依赖(上层依赖下层允许,反之不允许)
|
|
||||||
- **Public API 兼容性**:若改动涉及公共接口(`RDReaderView`、`RDReaderDataSource`、`RDURLReaderController`、`RDEPUBReaderController` 等),必须评估对宿主 App 的 breaking change 影响
|
|
||||||
- **渲染路径差异**:方案必须考虑三种渲染路径(`webFixedLayout` / `webInteractive` / `textReflowable`)的适用性,不能只覆盖单一路径
|
|
||||||
- **CocoaPods 发布影响**:若方案涉及新增依赖、资源文件或模块结构调整,必须评估 podspec 变更
|
|
||||||
- **RD 前缀规范**:所有新增类型必须使用 `RD` 前缀,EPUB 相关使用 `RDEPUB` 前缀
|
|
||||||
- **Legacy 层边界**:不在 Legacy 层新增功能;若方案涉及 Legacy 代码,必须明确是迁移还是在新层实现
|
|
||||||
|
|
||||||
## GSD-Inspired Discussion Rules
|
|
||||||
|
|
||||||
讨论阶段要像 `discuss -> plan -> verify` 闭环一样,先捕获决策,再验证计划,而不是直接跳到实现建议。
|
|
||||||
|
|
||||||
必须执行:
|
|
||||||
- 灰区捕获:先识别布局、接口形态、数据结构、错误态、路由、持久化、兼容性、回归范围等不明确点
|
|
||||||
- 事实核验:方案落地前必须用本仓库代码和 `Doc/` 文档确认入口、复用点、约束和风险
|
|
||||||
- 假设显式化:不能确认的问题必须写成 `Assumption`,不得藏在方案正文里
|
|
||||||
- 阻塞分级:会改变实现路径的问题标记为 `Blocking Decision`,不会改变路径的问题标记为 `Follow-up`
|
|
||||||
- 审计留痕:若落方案文档,必须包含"讨论结论 / 关键决策 / 假设 / 非范围 / 验证清单 / 开发交接指令"
|
|
||||||
- 计划可执行:最终方案必须足够小,能被开发 skill 直接逐项执行
|
|
||||||
|
|
||||||
禁止行为:
|
|
||||||
- 不得只输出宽泛建议,必须落到文件、类、方法、数据流或协议层面的执行点
|
|
||||||
- 不得在用户已确认方案后继续展开新方案,除非用户明确要求重新比较
|
|
||||||
- 不得把未经核验的包、SDK、接口能力写成已确认事实
|
|
||||||
- 不得把需要用户拍板的关键决策伪装成默认实现
|
|
||||||
|
|
||||||
## Required Workflow
|
|
||||||
|
|
||||||
### Phase 1 — 识别需求、范围、约束、现状
|
|
||||||
|
|
||||||
- 明确目标价值、影响模块(EPUBCore / EPUBTextRendering / RDReaderView / EPUBUI / Legacy)、In Scope / Out of Scope
|
|
||||||
- 识别当前项目里已有的实现模式、相邻能力和复用点
|
|
||||||
- 判断这是单层需求还是跨层需求
|
|
||||||
- 建立灰区清单,区分 `Blocking Decision` 与 `Follow-up`
|
|
||||||
|
|
||||||
### Phase 2 — 判断讨论模式
|
|
||||||
|
|
||||||
- 若方案未定:进入"多方案对比模式"
|
|
||||||
- 若方案已定:进入"单方案细化模式"
|
|
||||||
- 一旦用户已确认方案,后续同一轮讨论默认保持"单方案细化模式",除非用户明确要求重新打开方案比较
|
|
||||||
|
|
||||||
### Phase 3 — Research / Verify:核验代码与文档事实
|
|
||||||
|
|
||||||
- 对照当前仓库确认真实入口、调用链、数据模型、复用的 cell / view / handler / controller / protocol
|
|
||||||
- 若方案涉及新增文件,必须确认所属目录层级和是否需要更新 podspec 的 source_files
|
|
||||||
- 若方案涉及接口或数据字段,必须明确字段来源、空值策略和兼容策略
|
|
||||||
- 若方案涉及 JS 桥接,必须确认 epub-bridge.js 的交互契约
|
|
||||||
- 若发现文档和代码不一致,必须标注为风险或阻塞项
|
|
||||||
- 若核验结果推翻原方案,必须暂停说明,不得继续包装成可执行方案
|
|
||||||
|
|
||||||
### Phase 4A — 多方案对比模式:列出多种实现路径
|
|
||||||
|
|
||||||
- 至少提出 2 个可行方案,推荐 2-4 个方案
|
|
||||||
- 每个方案都要有清晰的实现方向,而不是抽象建议
|
|
||||||
- 优先从现有项目模式和复用能力出发
|
|
||||||
|
|
||||||
### Phase 4B — 多方案对比模式:比较方案优缺点和影响范围
|
|
||||||
|
|
||||||
- 比较每个方案的:
|
|
||||||
- 核心思路
|
|
||||||
- 落在哪一层(EPUBCore / EPUBTextRendering / RDReaderView / EPUBUI)
|
|
||||||
- 适用前提
|
|
||||||
- 优点
|
|
||||||
- 风险 / 成本
|
|
||||||
- 对 SDK 分层、Public API、podspec、回归范围的影响
|
|
||||||
- 明确哪些差异会真正影响后续实现和维护
|
|
||||||
|
|
||||||
### Phase 5A — 多方案对比模式:提出推荐方案,并列出待确认细节
|
|
||||||
|
|
||||||
- 必须明确推荐一个默认方案,不能只平铺选项
|
|
||||||
- 待确认项只保留真正影响实现的关键决策
|
|
||||||
- 默认产物为对话输出;若用户明确要求,再可选落到 `Doc/FeatureSolution/` 下方案文档
|
|
||||||
|
|
||||||
### Phase 5B — 单方案细化模式:围绕确认方案展开
|
|
||||||
|
|
||||||
- 不再输出"方案 A / 方案 B / 方案 C"式内容
|
|
||||||
- 不再补充"其他也可以这样做"的备选实现,除非用户明确要求回到方案比较
|
|
||||||
- 只讨论以下内容:
|
|
||||||
- 当前方案的实现拆解(文件 / 类 / 方法 / 协议)
|
|
||||||
- SDK 分层内的模块边界与职责分配
|
|
||||||
- 关键数据流 / 状态流 / 渲染流
|
|
||||||
- 复用点、依赖点、回归点
|
|
||||||
- 对三种渲染路径的覆盖情况
|
|
||||||
- 风险、前提、灰度方式、验证要点
|
|
||||||
- 交接给开发 skill 的实现摘要
|
|
||||||
|
|
||||||
### Phase 6 — 输出实现交接建议
|
|
||||||
|
|
||||||
- 在方案确认后,明确下一步应交给哪个开发 skill:
|
|
||||||
- 小中型、单层、MVP 优先:轻量开发 skill
|
|
||||||
- 跨层、复杂联调、完整交付:完整开发 skill
|
|
||||||
- 无论是否落文档,最终都必须产出开发交接载体,且二选一不能缺失:
|
|
||||||
- 完整开发 skill:产出可直接执行的开发详细文档,默认落到 `Doc/FeatureSolution/`
|
|
||||||
- 轻量开发 skill:产出可直接粘贴执行的开发详细描述,覆盖实现目标、范围、代码落点、关键步骤、验收标准和自测要点
|
|
||||||
- 给出可直接粘贴给开发 skill 的实现摘要;若已有更完整的详细文档/描述,则摘要必须引用它而不是只给一句话概括
|
|
||||||
- 若落方案文档,必须让开发指令引用该文档的真实路径,并提醒开发 skill 严格按计划执行
|
|
||||||
|
|
||||||
## Output Contract
|
|
||||||
|
|
||||||
默认输出结构按模式区分:
|
|
||||||
|
|
||||||
若方案未定:
|
|
||||||
- A. 需求理解
|
|
||||||
- B. 灰区问题与实现假设
|
|
||||||
- C. 当前实现与约束
|
|
||||||
- D. 可选方案对比
|
|
||||||
- E. 推荐方案
|
|
||||||
- F. 待确认实现细节
|
|
||||||
- G. 实现交接建议
|
|
||||||
|
|
||||||
若方案已定:
|
|
||||||
- A. 需求理解
|
|
||||||
- B. 灰区问题与实现假设
|
|
||||||
- C. 当前实现与约束
|
|
||||||
- D. 确认方案拆解
|
|
||||||
- E. 实现风险与关键细节
|
|
||||||
- F. 实现交接建议
|
|
||||||
|
|
||||||
其中要求:
|
|
||||||
- 未定方案时:
|
|
||||||
- `B. 灰区问题与实现假设` 必须区分 Blocking Decision / Follow-up / Assumption
|
|
||||||
- `D. 可选方案对比` 至少给出 2 个方案,推荐 2-4 个
|
|
||||||
- `E. 推荐方案` 必须明确推荐一个默认方案
|
|
||||||
- `F. 待确认实现细节` 只保留会改变实现路径的关键问题
|
|
||||||
- `G. 实现交接建议` 必须明确下一步交给哪个开发 skill
|
|
||||||
- `G. 实现交接建议` 必须附带可供开发 skill 直接使用的交接内容:
|
|
||||||
- 若下一步是完整开发 skill,必须提供开发详细文档路径或完整文档正文
|
|
||||||
- 若下一步是轻量开发 skill,必须提供开发详细描述正文
|
|
||||||
- 已定方案时:
|
|
||||||
- `B. 灰区问题与实现假设` 必须列出阻塞项、假设和后续项
|
|
||||||
- `D. 确认方案拆解` 只能围绕确认方案展开,禁止附带其他方案信息
|
|
||||||
- `E. 实现风险与关键细节` 只讨论该方案落地所需信息
|
|
||||||
- `F. 实现交接建议` 必须明确下一步交给哪个开发 skill,并附带可直接执行的详细文档或详细描述
|
|
||||||
|
|
||||||
若用户要求落方案文档,文档必须包含:
|
|
||||||
- 需求目标
|
|
||||||
- 讨论结论
|
|
||||||
- 关键决策
|
|
||||||
- 实现假设
|
|
||||||
- 非范围
|
|
||||||
- SDK 分层落点(文件 / 类 / 方法 / 协议)
|
|
||||||
- 数据流 / 状态流 / 渲染流
|
|
||||||
- 开发任务清单
|
|
||||||
- 验收标准
|
|
||||||
- 自测清单
|
|
||||||
- 待确认项
|
|
||||||
- 给开发 skill 的执行指令
|
|
||||||
|
|
||||||
若未落方案文档,但下一步要交给轻量开发 skill,则最终输出中的"开发详细描述"至少必须包含:
|
|
||||||
- 实现目标
|
|
||||||
- In Scope / Out of Scope
|
|
||||||
- SDK 分层落点(文件 / 类 / 方法 / 协议)
|
|
||||||
- 实现步骤
|
|
||||||
- 关键约束与复用点
|
|
||||||
- 对三种渲染路径的覆盖说明
|
|
||||||
- 验收标准
|
|
||||||
- 自测清单
|
|
||||||
- 待确认项或实现假设
|
|
||||||
|
|
||||||
## Validation
|
|
||||||
|
|
||||||
- 本 skill 默认只做方案讨论,不直接进入代码实现
|
|
||||||
- 默认不修改仓库文件;只有用户明确要求时,才可选落方案文档到 `Doc/FeatureSolution/`
|
|
||||||
- 即使不落方案文档,最终回复也必须包含一份可直接交给开发 skill 使用的详细交接内容,不能只停留在高层方案结论
|
|
||||||
- 若本次调用只做讨论或只新增方案文档,可不执行构建验证
|
|
||||||
- 若新增或移动方案文档,建议同步更新目录索引
|
|
||||||
- 若后续进入代码实现,则由对应开发 skill 负责执行项目默认构建验证(`xcodebuild` 或 CocoaPods 集成验证)
|
|
||||||
- 若用户已确认方案,则默认进入单方案细化模式,除非用户明确要求重新比较备选方案
|
|
||||||
|
|
||||||
## Maintenance Rules
|
|
||||||
|
|
||||||
- 该 skill 的职责是"讨论后交接实现",不和开发 skill、文档类 skill 重叠
|
|
||||||
- 优先复用 `Doc/` 作为知识源,不新增独立 references 体系
|
|
||||||
- 方案文档目录固定为 `Doc/FeatureSolution/`
|
|
||||||
- 持续保持 `discuss -> research/verify -> plan handoff` 的轻量闭环,避免退化成只聊天不交付的建议列表
|
|
||||||
- 若该 skill 的默认输出结构、交接规则或适用边界调整,必须同步更新对应文档
|
|
||||||
- SDK 四层架构(EPUBCore → EPUBTextRendering → RDReaderView → EPUBUI)是方案讨论的核心参照框架,任何方案都必须明确标注落点层级
|
|
||||||
@@ -1,213 +0,0 @@
|
|||||||
---
|
|
||||||
name: "Start SDK Feature Dev Lite"
|
|
||||||
description: "轻量开发主控 skill:用于 ReadViewSDK 的小中型功能开发、单层改动、局部重构、文档同步与编译修复。"
|
|
||||||
argument-hint: "粘贴需求、目标层级、验收标准;可附加:仅 MVP / 禁止新增依赖 / 指定渲染路径。"
|
|
||||||
---
|
|
||||||
|
|
||||||
# Start SDK Feature Dev Lite
|
|
||||||
|
|
||||||
## Purpose
|
|
||||||
|
|
||||||
面向 ReadViewSDK 的轻量开发入口 skill。
|
|
||||||
用于在现有项目约束下完成"小到中型"需求,遵循"先识别范围、再按需读文档、后实现、再验证、最后交付"的闭环。
|
|
||||||
|
|
||||||
该 skill 是默认开发入口,优先覆盖:
|
|
||||||
- 单层内的新功能 MVP 实现
|
|
||||||
- 小范围重构或代码整理
|
|
||||||
- 文档同步更新
|
|
||||||
- 编译错误定位与修复
|
|
||||||
- 单个模块的 bug 修复或行为调整
|
|
||||||
- podspec 小幅调整
|
|
||||||
|
|
||||||
默认吸收项目 `Doc/CODING_STYLE.md` 中的 Swift/iOS 通用规则;若任务重点落在并发、性能、可访问性或安全,再额外展开该专项的检查项。
|
|
||||||
|
|
||||||
## Core Execution Rules
|
|
||||||
|
|
||||||
- Rule 1 — Think Before Coding
|
|
||||||
- 先核对代码和文档事实,不静默假设
|
|
||||||
- 必须显式写出关键假设、主要取舍和已知风险
|
|
||||||
- 遇到会改变实现路径的关键灰区,先暂停确认,不靠猜测继续推进
|
|
||||||
- 若存在更简单且满足目标的实现路径,必须主动指出并优先采用
|
|
||||||
- Rule 2 — Simplicity First
|
|
||||||
- 只做满足需求和验收标准的最小实现
|
|
||||||
- 不增加推测性功能,不为单次使用引入抽象
|
|
||||||
- 若方案让资深工程师也会觉得过度设计,必须继续简化
|
|
||||||
- Rule 3 — Surgical Changes
|
|
||||||
- 只修改完成当前需求所必需的文件和代码
|
|
||||||
- 不顺手重构无关代码,不扩散到相邻层做"顺便优化"
|
|
||||||
- 非必要不改注释、格式或既有结构,新增代码保持现有风格
|
|
||||||
- Rule 4 — Goal-Driven Execution
|
|
||||||
- 先定义成功标准,再围绕成功标准实施和验证
|
|
||||||
- 不给自己堆步骤,重点是闭环达到验收结果
|
|
||||||
- 修改后必须验证,未验证通过前不能视为完成
|
|
||||||
|
|
||||||
## When To Use
|
|
||||||
|
|
||||||
当用户提出以下类型需求时使用:
|
|
||||||
- "使用 start-sdk-feature-dev-lite 完成这个功能"
|
|
||||||
- 在 ReadViewSDK 中开发单一功能或单层变更
|
|
||||||
- 需要修复局部编译错误或行为问题
|
|
||||||
- 需要同步更新文档
|
|
||||||
- 需要小幅调整 podspec
|
|
||||||
|
|
||||||
不适用场景:
|
|
||||||
- 需求跨多个 SDK 层级、涉及多阶段联调或需要完整项目级方案时,改用 `start-sdk-feature-dev`
|
|
||||||
- 目标是只生成文档而不改业务代码时,优先使用文档类 skill
|
|
||||||
- 目标是方案讨论而不进入实现时,优先使用 `discuss-sdk-feature-solution`
|
|
||||||
|
|
||||||
## Inputs
|
|
||||||
|
|
||||||
推荐输入:
|
|
||||||
- 功能名称
|
|
||||||
- 目标 / 用户价值
|
|
||||||
- 范围(In Scope)
|
|
||||||
- 非范围(Out of Scope)
|
|
||||||
- 目标层级(EPUBCore / EPUBTextRendering / RDReaderView / EPUBUI)
|
|
||||||
- 详细需求
|
|
||||||
- 验收标准
|
|
||||||
- 约束(兼容性 / 性能 / 禁止新增依赖 / 指定渲染路径)
|
|
||||||
|
|
||||||
若信息不足:
|
|
||||||
- 先基于代码和文档补齐可发现事实
|
|
||||||
- 再列最多 5 条关键假设
|
|
||||||
- 基于假设继续推进 MVP,并在交付中标注待确认项
|
|
||||||
|
|
||||||
## Scope / Required Context
|
|
||||||
|
|
||||||
仅针对 ReadViewSDK 现有架构执行。
|
|
||||||
|
|
||||||
SDK 四层架构参照:
|
|
||||||
- Layer 1 — EPUBCore(`Sources/RDReaderView/EPUBCore/`):EPUB 解析引擎
|
|
||||||
- Layer 2 — EPUBTextRendering(`Sources/RDReaderView/EPUBTextRendering/`):文本渲染路径
|
|
||||||
- Layer 3 — RDReaderView(`Sources/RDReaderView/` 根目录):分页阅读器容器
|
|
||||||
- Layer 4 — EPUBUI(`Sources/RDReaderView/EPUBUI/`):开箱即用 UI
|
|
||||||
- Legacy(`Sources/RDReaderView/LegacyRDReaderController/`):遗留代码,不在其上新增功能
|
|
||||||
|
|
||||||
分层依赖规则(上→下允许,下→上禁止):
|
|
||||||
- EPUBUI → RDReaderView → EPUBTextRendering → EPUBCore
|
|
||||||
|
|
||||||
默认先读:
|
|
||||||
1. `Doc/ARCHITECTURE.md` — 四层架构、数据流、分页模式、位置模型
|
|
||||||
2. `Doc/CODING_STYLE.md` — 命名规范、分层规则、extension 拆分规则
|
|
||||||
3. `Doc/EPUB_MAINTENANCE.md` — 文件职责表、渲染管线、排查场景
|
|
||||||
|
|
||||||
按需再读:
|
|
||||||
- `Doc/FeatureSolution/*.md`(若有方案文档)
|
|
||||||
- 涉及哪一层就读该层目录下的相关源码
|
|
||||||
- 涉及 JS 桥接时:`Sources/RDReaderView/Resources/epub-bridge.js`
|
|
||||||
- 涉及 podspec 时:`RDReaderView.podspec`
|
|
||||||
|
|
||||||
若文档与代码不一致:
|
|
||||||
- 以代码事实为准完成本次实现
|
|
||||||
- 在交付中标注不一致点,并指出建议更新的文档
|
|
||||||
|
|
||||||
## Required Workflow
|
|
||||||
|
|
||||||
### Phase 1 — 识别需求和范围
|
|
||||||
|
|
||||||
- 明确目标价值、影响层级(EPUBCore / EPUBTextRendering / RDReaderView / EPUBUI)、In Scope / Out of Scope
|
|
||||||
- 优先做最小可落地实现,不做需求外重构
|
|
||||||
- 若需求信息不足,先通过仓库事实补齐,再基于假设推进
|
|
||||||
|
|
||||||
### Phase 2 — 按需读取 Doc 与代码事实
|
|
||||||
|
|
||||||
- 先读默认 Doc(ARCHITECTURE / CODING_STYLE / EPUB_MAINTENANCE)
|
|
||||||
- 根据需求类型补读对应层级的源码
|
|
||||||
- 用源码确认真实入口、调用链和复用点,不只依赖文档
|
|
||||||
|
|
||||||
### Phase 3 — 形成最小实现方案
|
|
||||||
|
|
||||||
- 保持分层边界:
|
|
||||||
- EPUB 解析逻辑在 EPUBCore
|
|
||||||
- 文本渲染逻辑在 EPUBTextRendering
|
|
||||||
- 分页容器逻辑在 RDReaderView
|
|
||||||
- 开箱即用 UI 在 EPUBUI
|
|
||||||
- 不在 Legacy 层新增功能
|
|
||||||
- 命名、注释、日志风格遵循 `Doc/CODING_STYLE.md`
|
|
||||||
- Swift / iOS 默认规则:
|
|
||||||
- 新增 Swift 类型遵循 `RD` / `RDEPUB` 前缀和层级目录归属
|
|
||||||
- 避免新增强制解包;确需使用时必须先收敛前置条件
|
|
||||||
- 不为"现代化"而重写稳定代码;仅在本次需求明确受益时再迁移系统 API
|
|
||||||
- 当前项目默认保持 UIKit + Auto Layout + 既有组件风格,SDK 层不使用 SnapKit
|
|
||||||
- 注释和日志使用中文
|
|
||||||
- Debug 输出放在 `#if DEBUG` 守卫下
|
|
||||||
- 不在日志中输出敏感信息
|
|
||||||
- 异步闭包默认 `[weak self]`,UI 更新回到主线程
|
|
||||||
- 通知 / 定时器 / 回调在生命周期结束时必须清理
|
|
||||||
- 数据模型用 `struct` + `Codable` + `Equatable`,服务对象用 `final class`
|
|
||||||
- 可见性按最小原则:`private` > `fileprivate` > `internal` > `public`
|
|
||||||
- 错误使用 `enum` + `LocalizedError`,禁止 force unwrap
|
|
||||||
- 单文件若预计超过 600 行,需主动拆分扩展文件
|
|
||||||
|
|
||||||
### Phase 4 — 执行修改与文档同步
|
|
||||||
|
|
||||||
- 所有代码改动遵循最小改动原则
|
|
||||||
- 修改代码时必须补充必要注释,重点说明关键逻辑、边界条件和不直观处理;不要省略应有注释,也不要添加无信息量的描述性注释
|
|
||||||
- 默认补做轻量 SDK 自检:
|
|
||||||
- 新增类型是否使用正确前缀和层级归属
|
|
||||||
- 本次改动涉及的渲染路径是否正常工作
|
|
||||||
- Public API 是否有意外 breaking change
|
|
||||||
- podspec 是否需要更新(新增文件时)
|
|
||||||
- 生命周期、通知/定时器/回调清理是否完整
|
|
||||||
- 异步闭包是否考虑 `[weak self]`
|
|
||||||
- 修改代码后必须同步更新受影响文档,不能只停留在代码实现
|
|
||||||
- 若本次改动涉及 EPUB 维护相关,必须回写 `Doc/EPUB_MAINTENANCE.md`
|
|
||||||
- 若本次是方案讨论文档交接落地,方案类文档统一放到 `Doc/FeatureSolution/`
|
|
||||||
- 若新增、重命名或移动文档,必须同步更新目录索引
|
|
||||||
|
|
||||||
### Phase 5 — 构建验证与交付
|
|
||||||
|
|
||||||
- 完成修改后,按项目默认命令执行编译验证
|
|
||||||
- 若出现编译错误,自动修复并重编译
|
|
||||||
- 若遇构建锁问题,自动重试
|
|
||||||
- 交付时固定输出:
|
|
||||||
- A. 需求理解
|
|
||||||
- B. 开发计划
|
|
||||||
- C. 开发实施
|
|
||||||
- D. 验证结果
|
|
||||||
- E. 交付摘要
|
|
||||||
|
|
||||||
## Output Contract
|
|
||||||
|
|
||||||
最终回复必须完整输出以下 5 个板块,标题保持一致:
|
|
||||||
- A. 需求理解
|
|
||||||
- B. 开发计划
|
|
||||||
- C. 开发实施
|
|
||||||
- D. 验证结果
|
|
||||||
- E. 交付摘要
|
|
||||||
|
|
||||||
各板块内容要求:
|
|
||||||
- A:3-6 条,覆盖目标价值、范围、目标层级、限制
|
|
||||||
- B:按"方案对齐 / MVP 实现 / 验证与交付"三阶段组织
|
|
||||||
- C:描述实际改动、关键实现取舍,以及本次补充了哪些关键代码注释
|
|
||||||
- D:给出构建结果、关键路径验证、未覆盖风险
|
|
||||||
- E:列出改动文件、关键取舍、已同步文档与具体文档落点、后续建议
|
|
||||||
|
|
||||||
## Validation
|
|
||||||
|
|
||||||
若本次调用修改了任何 Swift / Objective-C / 工程配置 / podspec 文件,必须执行构建验证。
|
|
||||||
|
|
||||||
验证方式:
|
|
||||||
- 若 Demo 工程可用:
|
|
||||||
```bash
|
|
||||||
xcodebuild build -workspace ReadViewSDKDemo/ReadViewSDKDemo.xcworkspace -scheme ReadViewSDKDemo -sdk iphonesimulator -derivedDataPath /private/tmp/readview-sdk-derived
|
|
||||||
```
|
|
||||||
- 若仅有 SDK 源码(无 workspace):
|
|
||||||
```bash
|
|
||||||
pod lib lint RDReaderView.podspec --allow-warnings
|
|
||||||
```
|
|
||||||
|
|
||||||
验证规则:
|
|
||||||
- 编译失败时必须自行修复并重试
|
|
||||||
- 遇到 `database is locked` 等锁问题时自动重试,建议最多 5 次
|
|
||||||
- 直到 `BUILD SUCCEEDED` 或 `pod lib lint passed` 才可交付
|
|
||||||
- 如果本次仅修改文档或 skill 文件,可跳过构建,但要在交付中明确说明原因
|
|
||||||
|
|
||||||
## Maintenance Rules
|
|
||||||
|
|
||||||
- 优先复用 `Doc/`,不要把项目级规则复制进多个 skill 造成双份维护
|
|
||||||
- 新增项目约束时,优先更新 `Doc/CODING_STYLE.md`、`Doc/ARCHITECTURE.md` 等主文档,再调整 skill
|
|
||||||
- 轻量与完整要保持"轻重不同、规则不冲突",其中完整版应在轻量版闭环基础上扩展跨层与联调要求,而不是另起一套风格
|
|
||||||
- 变更默认流程、输出格式或适用场景时,必须同步更新相关文档
|
|
||||||
- 本 skill 持续作为默认开发入口,保持"轻量、清晰、可直接执行"
|
|
||||||
- SDK 四层架构是执行的核心参照框架,单层改动也必须明确标注落点层级
|
|
||||||
@@ -1,309 +0,0 @@
|
|||||||
---
|
|
||||||
name: "Start SDK Feature Dev"
|
|
||||||
description: "完整开发主控 skill:用于 ReadViewSDK 的跨层功能开发、多阶段联调、结构性重构与完整交付。"
|
|
||||||
argument-hint: "粘贴完整需求,建议包含:背景、目标、范围、目标层级、交互说明、数据约束、验收标准、渲染路径覆盖要求。"
|
|
||||||
---
|
|
||||||
|
|
||||||
# Start SDK Feature Dev
|
|
||||||
|
|
||||||
## Purpose
|
|
||||||
|
|
||||||
面向 ReadViewSDK 的完整开发主控 skill。
|
|
||||||
用于复杂度高于单层修改的需求,遵循"先识别范围、再按需读文档、后对齐既定开发计划、再严格执行、再验证、最后交付"的闭环,并补充跨层联调、风险控制、回滚点和完整交付要求。
|
|
||||||
|
|
||||||
该 skill 优先覆盖:
|
|
||||||
- 跨多个 SDK 层级(EPUBCore / EPUBTextRendering / RDReaderView / EPUBUI)的功能开发
|
|
||||||
- 多阶段联调与完整交付
|
|
||||||
- 结构性重构或系统性收敛
|
|
||||||
- 涉及 EPUB 解析、渲染管线、阅读器容器、UI 层协同改造的需求
|
|
||||||
- 需要更完整风险说明、文档同步和验收闭环的开发任务
|
|
||||||
|
|
||||||
默认吸收项目 `Doc/CODING_STYLE.md` 中的 Swift/iOS 通用规则;若任务重点落在并发、性能、可访问性或安全,再额外展开该专项的检查项。
|
|
||||||
|
|
||||||
## Core Execution Rules
|
|
||||||
|
|
||||||
- Rule 1 — Think Before Coding
|
|
||||||
- 先核对代码、文档和计划事实,不静默假设
|
|
||||||
- 必须显式写出关键假设、主要取舍和已知风险
|
|
||||||
- 遇到会改变计划或实现路径的关键灰区,先暂停确认,不靠猜测继续推进
|
|
||||||
- 若存在更简单且满足目标的实现路径,只能作为建议提出;有既定计划时不得自行改用
|
|
||||||
- Rule 2 — Simplicity First
|
|
||||||
- 只做满足需求、计划和验收标准的最小实现
|
|
||||||
- 不增加推测性功能,不为单次使用引入抽象
|
|
||||||
- 若方案让资深工程师也会觉得过度设计,必须继续简化或回到计划边界内
|
|
||||||
- Rule 3 — Surgical Changes
|
|
||||||
- 只修改完成当前需求和计划项所必需的文件与代码
|
|
||||||
- 不顺手重构无关代码,不扩散到相邻层做"顺便优化"
|
|
||||||
- 非必要不改注释、格式或既有结构,新增代码保持现有风格
|
|
||||||
- Rule 4 — Goal-Driven Execution
|
|
||||||
- 先定义成功标准,再围绕成功标准实施和验证
|
|
||||||
- 计划只是约束,不是目标本身;目标是按计划完成验收闭环
|
|
||||||
- 修改后必须验证,未验证通过前不能视为完成
|
|
||||||
|
|
||||||
## Plan Execution Rule
|
|
||||||
|
|
||||||
若用户提供了开发计划文档、方案文档或明确引用 `Doc/FeatureSolution/*.md` 中的开发方案,本 skill 必须把该文档视为本次实现的主计划来源。
|
|
||||||
|
|
||||||
严格执行规则:
|
|
||||||
- 必须先完整读取用户指定的开发计划文档,再开始代码修改
|
|
||||||
- 必须从计划中抽取任务清单、文件清单、实现边界、非范围和验收标准
|
|
||||||
- 必须按计划逐项实现,不得自行更换方案、合并步骤、替换文件布局、改变数据模型设计或引入计划外抽象
|
|
||||||
- 必须遵守计划中的"不做 / 不新增 / 不使用 / 暂不实现"等限制项
|
|
||||||
- 若计划与代码事实冲突,或计划中某项无法直接落地,必须暂停并向用户说明冲突点、影响和可选处理方式;不得自行选择替代方案继续实现
|
|
||||||
- 若发现更优实现方式,只能作为"建议"在交付或暂停说明中提出,不得在本次实现中自由采用
|
|
||||||
- 若计划未覆盖某个必要细节,只允许做最小补齐;补齐内容必须在交付中明确标注为"计划未写明,按最小必要实现补齐"
|
|
||||||
- 若用户要求"严格按照开发计划执行 / 不要自由发挥",必须把偏离计划视为阻塞项处理
|
|
||||||
|
|
||||||
## When To Use
|
|
||||||
|
|
||||||
当用户提出以下类型需求时使用:
|
|
||||||
- "使用 start-sdk-feature-dev 实现这个需求"
|
|
||||||
- 一个需求影响多个 SDK 层级(跨 EPUBCore / EPUBTextRendering / RDReaderView / EPUBUI)
|
|
||||||
- 需要完整计划、实现、联调、回归和文档交付
|
|
||||||
- 需要跨 EPUB 解析、渲染、阅读器容器、UI 的协同改造
|
|
||||||
- 需要明确阶段性计划、回滚点和完整验收说明
|
|
||||||
|
|
||||||
Lite 与 Full 的边界:
|
|
||||||
- 轻量开发 skill:单层、小中型、MVP 优先
|
|
||||||
- 本 skill(start-sdk-feature-dev):跨层、复杂联调、需要更完整方案和验收
|
|
||||||
|
|
||||||
## Inputs
|
|
||||||
|
|
||||||
推荐输入模板:
|
|
||||||
- 功能名称
|
|
||||||
- 背景与目标
|
|
||||||
- 用户故事
|
|
||||||
- 详细需求
|
|
||||||
- 非范围
|
|
||||||
- 目标层级(EPUBCore / EPUBTextRendering / RDReaderView / EPUBUI / Legacy)
|
|
||||||
- 交互说明(含空态 / 错误态 / 加载态)
|
|
||||||
- 渲染路径覆盖要求(webFixedLayout / webInteractive / textReflowable / 不限)
|
|
||||||
- 数据与接口约束
|
|
||||||
- 验收标准(Given-When-Then)
|
|
||||||
- 兼容性要求(Public API 是否 breaking、podspec 变更等)
|
|
||||||
- 性能与安全要求
|
|
||||||
- 发布时间或优先级
|
|
||||||
|
|
||||||
若信息不足:
|
|
||||||
- 先基于代码和文档补齐可发现事实
|
|
||||||
- 再列最多 5 条关键假设
|
|
||||||
- 若没有既定开发计划,可基于假设继续推进最小可落地实现,并在交付中标注待确认项
|
|
||||||
- 若已有开发计划,信息不足时不得自行扩展方案;只能做计划内实现或暂停确认
|
|
||||||
|
|
||||||
## Scope / Required Context
|
|
||||||
|
|
||||||
仅针对 ReadViewSDK 现有架构执行。
|
|
||||||
|
|
||||||
SDK 四层架构参照:
|
|
||||||
- Layer 1 — EPUBCore(`Sources/RDReaderView/EPUBCore/`):EPUB 解析引擎,ZIP 解压、OPF 解析、manifest/spine/TOC、资源 URL 解析、离屏 WKWebView 分页、阅读会话状态机、JS 桥接
|
|
||||||
- Layer 2 — EPUBTextRendering(`Sources/RDReaderView/EPUBTextRendering/`):文本渲染路径,DTCoreText 转 NSAttributedString 后按字符范围分页
|
|
||||||
- Layer 3 — RDReaderView(`Sources/RDReaderView/` 根目录 6 个文件):分页阅读器容器 UIView,支持 pageCurl / horizontalScroll / verticalScroll / horizontalCoverScroll 四种模式
|
|
||||||
- Layer 4 — EPUBUI(`Sources/RDReaderView/EPUBUI/`):开箱即用 UI,工具栏、目录面板、高亮管理、设置面板、阅读位置持久化
|
|
||||||
- Legacy(`Sources/RDReaderView/LegacyRDReaderController/`):遗留代码,不在其上新增功能
|
|
||||||
|
|
||||||
分层依赖规则:
|
|
||||||
- 上层可依赖下层,下层不得依赖上层
|
|
||||||
- EPUBUI 可依赖 RDReaderView、EPUBTextRendering、EPUBCore
|
|
||||||
- RDReaderView 可依赖 EPUBTextRendering、EPUBCore
|
|
||||||
- EPUBTextRendering 可依赖 EPUBCore
|
|
||||||
- EPUBCore 不依赖任何上层
|
|
||||||
|
|
||||||
若确需跨层改动:
|
|
||||||
- 必须在计划中写明影响范围
|
|
||||||
- 必须在交付中写明回滚点或回退策略
|
|
||||||
|
|
||||||
默认先读:
|
|
||||||
1. `Doc/ARCHITECTURE.md` — 四层架构、数据流、分页模式、位置模型、已知限制
|
|
||||||
2. `Doc/CODING_STYLE.md` — 命名规范(RD/RDEPUB 前缀)、分层规则、extension 拆分、SS→RD 迁移计划
|
|
||||||
3. `Doc/EPUB_MAINTENANCE.md` — 文件职责表、DTCoreText 渲染管线、常见排查场景
|
|
||||||
|
|
||||||
按需再读:
|
|
||||||
- `Doc/FeatureSolution/*.md`(若有方案文档)
|
|
||||||
- 涉及 EPUB 解析时:`Sources/RDReaderView/EPUBCore/` 下相关文件
|
|
||||||
- 涉及文本渲染时:`Sources/RDReaderView/EPUBTextRendering/` 下相关文件
|
|
||||||
- 涉及阅读器容器时:`Sources/RDReaderView/RDReaderView.swift` 及同级文件
|
|
||||||
- 涉及 UI 层时:`Sources/RDReaderView/EPUBUI/` 下相关文件
|
|
||||||
- 涉及遗留代码时:`Sources/RDReaderView/LegacyRDReaderController/` 下相关文件
|
|
||||||
- 涉及 JS 桥接时:`Sources/RDReaderView/Resources/epub-bridge.js`
|
|
||||||
- 涉及 podspec 时:`RDReaderView.podspec`
|
|
||||||
|
|
||||||
若文档与代码不一致:
|
|
||||||
- 以代码事实为准落地
|
|
||||||
- 在交付中说明不一致点和建议更新的文档项
|
|
||||||
|
|
||||||
若开发计划文档与代码不一致:
|
|
||||||
- 不得直接以代码事实替换计划继续开发
|
|
||||||
- 必须先判断不一致是否影响计划执行
|
|
||||||
- 会影响计划执行时,暂停并向用户说明冲突点和建议调整项
|
|
||||||
- 不影响计划执行时,按计划继续,并在交付中标注该不一致点
|
|
||||||
|
|
||||||
## SDK-Specific Execution Rules
|
|
||||||
|
|
||||||
### 命名与可见性
|
|
||||||
- 所有新增类型必须使用 `RD` 前缀,EPUB 相关使用 `RDEPUB` 前缀
|
|
||||||
- 新增类型归属正确层级目录,不得随意放置
|
|
||||||
- 可见性按最小原则:`private` > `fileprivate` > `internal` > `public`
|
|
||||||
- 数据模型用 `struct` + `Codable` + `Equatable`
|
|
||||||
- 服务对象用 `final class`
|
|
||||||
|
|
||||||
### 代码组织
|
|
||||||
- 单文件超过 600 行需主动拆分 `TypeName+Feature.swift` 扩展文件
|
|
||||||
- 大型 Controller 超过 1000 行必须拆分
|
|
||||||
- extension 文件承担独立子职责,不只做"行数搬运"
|
|
||||||
|
|
||||||
### 内存与并发
|
|
||||||
- 异步闭包默认 `[weak self]`
|
|
||||||
- UI 更新必须回到主线程
|
|
||||||
- 通知 / 定时器 / 回调在 deinit 或生命周期结束时必须清理
|
|
||||||
|
|
||||||
### 渲染路径覆盖
|
|
||||||
- 新增功能必须评估对三种渲染路径的影响:
|
|
||||||
- `webFixedLayout`:固定版式 EPUB(漫画、绘本)— WKWebView 渲染
|
|
||||||
- `webInteractive`:可重排 + 交互脚本 EPUB — WKWebView 渲染
|
|
||||||
- `textReflowable`:纯文本可重排 EPUB — DTCoreText 渲染
|
|
||||||
- 若功能仅适用于部分路径,必须在交付中明确标注适用范围和不适用路径的处理方式
|
|
||||||
|
|
||||||
### Public API 兼容性
|
|
||||||
- 涉及公共接口(`RDReaderView`、`RDReaderDataSource`、`RDURLReaderController`、`RDEPUBReaderController` 等)的改动,必须评估 breaking change
|
|
||||||
- 若存在 breaking change,必须在交付中标注并给出迁移指引
|
|
||||||
- 新增 public API 需考虑 Objective-C 互操作(`@objc`、`@objcMembers`)
|
|
||||||
|
|
||||||
### CocoaPods 发布影响
|
|
||||||
- 新增源文件:确认 podspec `source_files` glob 是否已覆盖
|
|
||||||
- 新增资源文件:确认 podspec `resource` / `resource_bundles` 是否已覆盖
|
|
||||||
- 新增依赖:确认 podspec `dependency` 是否已声明,评估对宿主 App 的依赖传递影响
|
|
||||||
- 模块目录结构调整:必须同步更新 podspec
|
|
||||||
|
|
||||||
### JS 桥接
|
|
||||||
- 涉及 `epub-bridge.js` 的改动,必须确认 JS ↔ Swift 消息契约的一致性
|
|
||||||
- JS 侧新增消息类型时,Swift 侧必须有对应处理分支
|
|
||||||
- 修改已有消息类型时,必须评估向后兼容
|
|
||||||
|
|
||||||
### 错误处理
|
|
||||||
- 使用 `enum` + `LocalizedError` 定义错误类型
|
|
||||||
- 禁止 force unwrap(`!`),确需使用时必须先收敛前置条件
|
|
||||||
- 关键路径的错误必须向调用方传递,不得静默吞掉
|
|
||||||
|
|
||||||
## Required Workflow
|
|
||||||
|
|
||||||
### Phase 1 — 识别需求和范围
|
|
||||||
|
|
||||||
- 明确目标价值、影响层级(EPUBCore / EPUBTextRendering / RDReaderView / EPUBUI / Legacy)、In Scope / Out of Scope
|
|
||||||
- 判断是否涉及跨层、跨渲染路径、跨模块联调
|
|
||||||
- 若用户提供开发计划文档,先确认本次执行的唯一计划来源,并提取计划任务清单
|
|
||||||
- 优先做计划内最小可落地实现,不做需求外重构
|
|
||||||
- 若需求信息不足,先通过仓库事实补齐,再基于假设推进
|
|
||||||
|
|
||||||
### Phase 2 — 按需读取 Doc 与代码事实
|
|
||||||
|
|
||||||
- 若用户指定开发计划文档,必须先完整读取该文档
|
|
||||||
- 先读默认 Doc(ARCHITECTURE / CODING_STYLE / EPUB_MAINTENANCE)
|
|
||||||
- 根据需求类型补读各层源码和相关文档
|
|
||||||
- 用源码确认真实入口、调用链、数据流、状态流和复用点,不只依赖文档
|
|
||||||
|
|
||||||
### Phase 3 — 对齐并锁定开发计划
|
|
||||||
|
|
||||||
- 若已有开发计划,必须按计划锁定实现路径,不重新设计方案
|
|
||||||
- 若没有开发计划,才允许形成最小可落地方案:先复用现有模式与能力,再考虑新增抽象
|
|
||||||
- 保持分层边界:
|
|
||||||
- EPUB 解析逻辑在 EPUBCore
|
|
||||||
- 文本渲染逻辑在 EPUBTextRendering
|
|
||||||
- 分页容器逻辑在 RDReaderView
|
|
||||||
- 开箱即用 UI 在 EPUBUI
|
|
||||||
- 不在 Legacy 层新增功能
|
|
||||||
- 命名、注释、日志风格遵循 `Doc/CODING_STYLE.md`
|
|
||||||
- Swift / iOS 默认规则:
|
|
||||||
- 新增 Swift 类型遵循 `RD` / `RDEPUB` 前缀和层级目录归属
|
|
||||||
- 避免新增强制解包;确需使用时必须先收敛前置条件
|
|
||||||
- 不为"现代化"而重写稳定代码;仅在本次需求明确受益时再迁移系统 API
|
|
||||||
- 当前项目默认保持 UIKit + Auto Layout + 既有组件风格,SDK 层不使用 SnapKit
|
|
||||||
- 注释和日志使用中文
|
|
||||||
- Debug 输出放在 `#if DEBUG` 守卫下
|
|
||||||
- 不在日志中输出敏感信息
|
|
||||||
- 单文件预计超过 600 行需主动拆分,超过 1000 行必须拆分
|
|
||||||
- 若为跨层需求,计划中必须写清:
|
|
||||||
- 主改动层级
|
|
||||||
- 被影响层级
|
|
||||||
- 渲染路径覆盖范围
|
|
||||||
- 联调依赖点
|
|
||||||
- 关键风险
|
|
||||||
- 回滚点或降级方式
|
|
||||||
- 开始编码前必须形成内部执行清单,清单项必须能追溯到开发计划;计划外项只能标记为"必要补齐"或"待确认",不能直接实施
|
|
||||||
|
|
||||||
### Phase 4 — 执行修改与文档同步
|
|
||||||
|
|
||||||
- 所有代码改动遵循计划内最小改动原则
|
|
||||||
- 严格按开发计划清单逐项修改;不得临时改换实现方式或增加计划外功能
|
|
||||||
- 若执行中需要偏离计划,必须暂停确认,不能先改后说明
|
|
||||||
- 修改代码时必须补充必要注释,重点说明关键逻辑、边界条件和不直观处理
|
|
||||||
- 默认补做 SDK 自检:
|
|
||||||
- 检查新增类型是否使用正确前缀和层级归属
|
|
||||||
- 检查三种渲染路径的覆盖情况
|
|
||||||
- 检查 Public API 是否有意外 breaking change
|
|
||||||
- 检查 podspec 是否需要更新
|
|
||||||
- 检查 JS 桥接消息契约是否一致
|
|
||||||
- 关键页面或组件检查生命周期、通知/定时器/回调清理是否完整
|
|
||||||
- 新增 UI 检查长文本、图标按钮语义、重要状态是否只靠颜色表达
|
|
||||||
- 异步闭包默认考虑 `[weak self]`,UI 更新回到主线程
|
|
||||||
- 修改代码后必须同步更新受影响文档,不能只停留在代码实现
|
|
||||||
- 若本次改动涉及 EPUB 维护相关,必须回写 `Doc/EPUB_MAINTENANCE.md`
|
|
||||||
- 若本次是方案讨论文档交接落地,方案类文档统一放到 `Doc/FeatureSolution/`
|
|
||||||
- 若新增、重命名或移动文档,必须同步更新目录索引
|
|
||||||
|
|
||||||
### Phase 5 — 构建验证与交付
|
|
||||||
|
|
||||||
- 完成修改后,按项目默认命令执行编译验证
|
|
||||||
- 若出现编译错误,自动修复并重编译
|
|
||||||
- 若遇构建锁问题,自动重试(建议最多 5 次)
|
|
||||||
- 若是跨层需求,除构建外还应补充关键联调路径说明
|
|
||||||
- 交付时固定输出:
|
|
||||||
- A. 需求理解
|
|
||||||
- B. 开发计划
|
|
||||||
- C. 开发实施
|
|
||||||
- D. 验证结果
|
|
||||||
- E. 交付摘要
|
|
||||||
|
|
||||||
## Output Contract
|
|
||||||
|
|
||||||
最终回复必须完整输出以下 5 个固定板块:
|
|
||||||
- A. 需求理解
|
|
||||||
- B. 开发计划
|
|
||||||
- C. 开发实施
|
|
||||||
- D. 验证结果
|
|
||||||
- E. 交付摘要
|
|
||||||
|
|
||||||
各板块内容要求:
|
|
||||||
- A:3-8 条,覆盖目标价值、范围、目标层级、渲染路径覆盖、交互流、限制
|
|
||||||
- B:按"计划来源 / 计划任务清单 / 执行顺序 / 验证与交付"组织;若有开发计划文档,必须逐条对应计划项
|
|
||||||
- C:描述实现过程、复用点、关键取舍,以及本次补充了哪些关键代码注释;若有计划未写明但必须补齐的内容,必须单独标注
|
|
||||||
- D:给出编译结果、关键路径验证、自动重试/自动修复情况、未覆盖风险
|
|
||||||
- E:列出改动文件、计划符合情况、关键取舍、回滚点或降级方式、已同步文档与具体文档落点、后续建议
|
|
||||||
|
|
||||||
## Validation
|
|
||||||
|
|
||||||
若本次调用修改了任何 Swift / Objective-C / 工程配置 / podspec 文件,必须执行构建验证。
|
|
||||||
|
|
||||||
验证方式:
|
|
||||||
- 若 Demo 工程可用:
|
|
||||||
```bash
|
|
||||||
xcodebuild build -workspace ReadViewSDKDemo/ReadViewSDKDemo.xcworkspace -scheme ReadViewSDKDemo -sdk iphonesimulator -derivedDataPath /private/tmp/readview-sdk-derived
|
|
||||||
```
|
|
||||||
- 若仅有 SDK 源码(无 workspace):
|
|
||||||
```bash
|
|
||||||
pod lib lint RDReaderView.podspec --allow-warnings
|
|
||||||
```
|
|
||||||
|
|
||||||
验证规则:
|
|
||||||
- 若出现编译错误,必须自动修复并重编译
|
|
||||||
- 若遇到 `database is locked` 等构建锁问题,自动重试,建议最多 5 次
|
|
||||||
- 直到 `BUILD SUCCEEDED` 或 `pod lib lint passed` 才可进入交付阶段
|
|
||||||
- 若本次只改文档或 skill 文件,可跳过编译,但要在交付中明确说明
|
|
||||||
|
|
||||||
## Maintenance Rules
|
|
||||||
|
|
||||||
- 优先复用 `Doc/`,不要把项目级规则复制进多个 skill 造成双份维护
|
|
||||||
- 新增项目约束时,优先更新 `Doc/CODING_STYLE.md`、`Doc/ARCHITECTURE.md` 等主文档,再调整 skill
|
|
||||||
- 轻量与完整要保持"轻重不同、规则不冲突",其中完整版应在轻量版闭环基础上扩展跨层与联调要求,而不是另起一套风格
|
|
||||||
- 变更默认流程、输出格式或适用边界时,必须同步更新相关文档
|
|
||||||
- 本 skill 持续作为完整开发入口,保持"可执行、可联调、可回滚、可交付"
|
|
||||||
- SDK 四层架构(EPUBCore → EPUBTextRendering → RDReaderView → EPUBUI)是执行的核心参照框架,所有改动必须明确标注落点层级和依赖方向
|
|
||||||
+16
-1
@@ -6,15 +6,24 @@ xcuserdata/
|
|||||||
.artifacts/
|
.artifacts/
|
||||||
.deriveddata/
|
.deriveddata/
|
||||||
.swift-module-cache/
|
.swift-module-cache/
|
||||||
|
ReadViewDemo/build/
|
||||||
|
|
||||||
# This repository checks in the Demo Pods project. Keep generated files for the
|
# This repository checks in the Demo Pods project. Keep generated files for the
|
||||||
# local RDEpubReaderView pod visible even when a global gitignore excludes Pods.
|
# local RDEpubReaderView/RDPDFReaderView pods and vendored SnapKit visible even
|
||||||
|
# when a global gitignore excludes Pods.
|
||||||
!ReadViewDemo/Pods/
|
!ReadViewDemo/Pods/
|
||||||
!ReadViewDemo/Pods/Local Podspecs/
|
!ReadViewDemo/Pods/Local Podspecs/
|
||||||
!ReadViewDemo/Pods/Local Podspecs/RDEpubReaderView.podspec.json
|
!ReadViewDemo/Pods/Local Podspecs/RDEpubReaderView.podspec.json
|
||||||
|
!ReadViewDemo/Pods/Local Podspecs/RDPDFReaderView.podspec.json
|
||||||
!ReadViewDemo/Pods/Target Support Files/
|
!ReadViewDemo/Pods/Target Support Files/
|
||||||
!ReadViewDemo/Pods/Target Support Files/RDEpubReaderView/
|
!ReadViewDemo/Pods/Target Support Files/RDEpubReaderView/
|
||||||
!ReadViewDemo/Pods/Target Support Files/RDEpubReaderView/**
|
!ReadViewDemo/Pods/Target Support Files/RDEpubReaderView/**
|
||||||
|
!ReadViewDemo/Pods/Target Support Files/RDPDFReaderView/
|
||||||
|
!ReadViewDemo/Pods/Target Support Files/RDPDFReaderView/**
|
||||||
|
!ReadViewDemo/Pods/SnapKit/
|
||||||
|
!ReadViewDemo/Pods/SnapKit/**
|
||||||
|
!ReadViewDemo/Pods/Target Support Files/SnapKit/
|
||||||
|
!ReadViewDemo/Pods/Target Support Files/SnapKit/**
|
||||||
|
|
||||||
# macOS system files
|
# macOS system files
|
||||||
.DS_Store
|
.DS_Store
|
||||||
@@ -24,3 +33,9 @@ xcuserdata/
|
|||||||
|
|
||||||
# AI tool output
|
# AI tool output
|
||||||
_ssoft-output/
|
_ssoft-output/
|
||||||
|
.claude/*
|
||||||
|
!.claude/skills
|
||||||
|
|
||||||
|
# Python bytecode
|
||||||
|
__pycache__/
|
||||||
|
*.py[cod]
|
||||||
|
|||||||
@@ -1,3 +1,67 @@
|
|||||||
# AGENTS.md
|
# ReadViewSDK AI 开发规则
|
||||||
|
|
||||||
- If using XcodeBuildMCP, use the installed XcodeBuildMCP skill before calling XcodeBuildMCP tools.
|
## 适用范围与语言
|
||||||
|
|
||||||
|
- 默认处理当前仓库的 EPUB SDK、PDF SDK、Demo 和测试。
|
||||||
|
- 计划、交付说明、`Doc/` 与项目 Markdown 使用中文。
|
||||||
|
- 代码标识符、文件名、API 和配置键保持英文;代码注释、Docstring 和提交信息使用中文。
|
||||||
|
- 只做当前目标所需的最小改动,保留工作区内与任务无关的未提交修改。
|
||||||
|
- 任何写文件的 agent 必须先读取 `CONTEXT.md`。
|
||||||
|
|
||||||
|
## 自动选择项目 Skill
|
||||||
|
|
||||||
|
根据用户意图选择 `.agents/skills/` 中最匹配的 Skill:
|
||||||
|
|
||||||
|
- 先讨论、比较方案、不要改代码:`discuss-sdk-feature-solution`
|
||||||
|
- 单模块功能、Bug 修复、UI 调整、局部重构、构建修复:`start-sdk-feature-dev-lite`
|
||||||
|
- 跨层/跨阅读器改造、公共 API 或持久化迁移、复杂联调、完整方案执行:`start-sdk-feature-dev`
|
||||||
|
- 隐藏问题、并发、生命周期、性能、内存、缓存或兼容性审查:`review-swift-ios-sdk`
|
||||||
|
- 全局代码规范:`generate-sdk-code-style-doc`
|
||||||
|
- 单模块代码规范:`generate-module-code-style-doc`
|
||||||
|
- 模块调用链、状态流、分页或缓存实现逻辑:`generate-module-implementation-logic`
|
||||||
|
- 审查改动、生成详细中文提交说明并提交或推送 Git:`commit-git-changes`
|
||||||
|
|
||||||
|
不要为简单任务叠加多个 Skill。用户明确指定 Skill 时优先使用;任务边界扩大时再切换或补充,并说明原因。
|
||||||
|
|
||||||
|
## 文档按需读取
|
||||||
|
|
||||||
|
先定位源码,再读取直接相关文档,不默认全文加载整个 `Doc/`:
|
||||||
|
|
||||||
|
| 任务 | 必读资料 |
|
||||||
|
| --- | --- |
|
||||||
|
| 任意代码修改 | `CONTEXT.md`、`Doc/CONVENTIONS.md` 相关章节 |
|
||||||
|
| 分层或跨模块改造 | `Doc/ARCHITECTURE.md` |
|
||||||
|
| 公共 API | `Doc/API_REFERENCE.md` 与真实 public 声明 |
|
||||||
|
| EPUB 解析/排版/分页/UI | 对应 `Doc/*_CODE_REFERENCE.md` 或专题文档 |
|
||||||
|
| PDF 阅读器 | `Sources/RDPDFReaderView` 源码;现有文档不足时以源码为准 |
|
||||||
|
| 测试与回归 | `Doc/TESTING.md` |
|
||||||
|
| 用户指定方案 | 指定文档,必须完整读取 |
|
||||||
|
|
||||||
|
`Doc/index.md` 用于路由。文档与源码冲突时以当前源码为事实,并指出待同步项。
|
||||||
|
|
||||||
|
## 模块边界
|
||||||
|
|
||||||
|
- EPUB:`EPUBCore` → `EPUBTextRendering` → `ReaderView` → `EPUBUI`,禁止下层反向依赖上层。
|
||||||
|
- PDF:通用分页容器位于 `Sources/RDPDFReaderView/ReaderView`,成品能力位于 `Sources/RDPDFReaderView/Sources`。
|
||||||
|
- Demo 和 UITests 只承担集成、样例与回归,不承载 SDK 核心业务。
|
||||||
|
- 保持 UIKit、SnapKit 和当前 CocoaPods 结构;新增依赖、资源或系统 framework 时同步检查对应 podspec。
|
||||||
|
- 新增类型遵循现有 `RD`、`RDEPUB`、`RDPDF` 前缀和最小可见性。
|
||||||
|
|
||||||
|
## SDK 兼容与质量
|
||||||
|
|
||||||
|
- 修改 public API 前评估宿主源码兼容、默认行为和迁移方式。
|
||||||
|
- 修改 Codable、持久化文件、缓存键或 book identifier 时提供版本与失效/迁移策略。
|
||||||
|
- UI 更新回主线程;异步任务处理取消、超时、迟到结果、恰好一次完成和生命周期。
|
||||||
|
- EPUB 改动检查 `.textReflowable`、`.webInteractive`、`.webFixedLayout` 的影响。
|
||||||
|
- PDF 改动检查宿主图片 Provider 与内置 PDFKit Provider 的影响。
|
||||||
|
- 滚动、缩放、分页和绘画热点避免同步 IO、重复解码、无界缓存和大对象长期驻留。
|
||||||
|
|
||||||
|
## 验证
|
||||||
|
|
||||||
|
修改 Swift、工程配置或 podspec 后默认执行:
|
||||||
|
|
||||||
|
`xcodebuild -workspace ReadViewDemo/ReadViewDemo.xcworkspace -scheme ReadViewDemo -configuration Debug -sdk iphonesimulator CODE_SIGNING_ALLOWED=NO build`
|
||||||
|
|
||||||
|
按风险补充 `Doc/TESTING.md` 中的定向 UI 测试。仅修改文档、规则或 Skill 时可跳过 Xcode 构建,但必须执行结构、引用和格式检查。
|
||||||
|
|
||||||
|
如果使用 XcodeBuildMCP,调用其工具前必须先读取已安装的 XcodeBuildMCP Skill,并先检查 session defaults。
|
||||||
|
|||||||
+3
-3
@@ -7,8 +7,8 @@
|
|||||||
## 语言与工程约束
|
## 语言与工程约束
|
||||||
|
|
||||||
- **主要语言**:Swift(Podspec 声明 `s.swift_versions = ["5.10"]`,见 `RDEpubReaderView.podspec`)
|
- **主要语言**:Swift(Podspec 声明 `s.swift_versions = ["5.10"]`,见 `RDEpubReaderView.podspec`)
|
||||||
- **最低系统版本**:Podspec `iOS 15.0`(`RDEpubReaderView.podspec`),示例工程 Podfile/构建设置里常见为 `iOS 15.6`(`Podfile`)
|
- **最低系统版本**:Podspec `iOS 15.0`(`RDEpubReaderView.podspec`),示例工程 Podfile/构建设置里常见为 `iOS 15.6`(`ReadViewDemo/Podfile`)
|
||||||
- **依赖管理**:CocoaPods(`Podfile`、`ReadViewDemo/Podfile`、`Podfile.lock`)
|
- **依赖管理**:CocoaPods(`ReadViewDemo/Podfile`、`ReadViewDemo/Podfile.lock`)
|
||||||
|
|
||||||
## 命名约定
|
## 命名约定
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@
|
|||||||
## Evidence(关键证据文件)
|
## Evidence(关键证据文件)
|
||||||
|
|
||||||
- `CONTEXT.md`
|
- `CONTEXT.md`
|
||||||
- `Podfile`
|
- `ReadViewDemo/Podfile`
|
||||||
- `RDEpubReaderView.podspec`
|
- `RDEpubReaderView.podspec`
|
||||||
- `ReadViewDemo/ReadViewDemo/ViewController.swift`
|
- `ReadViewDemo/ReadViewDemo/ViewController.swift`
|
||||||
- `Sources/RDEpubReaderView/ReaderView/RDEpubReaderView.swift`
|
- `Sources/RDEpubReaderView/ReaderView/RDEpubReaderView.swift`
|
||||||
|
|||||||
+3
-3
@@ -64,13 +64,13 @@
|
|||||||
|
|
||||||
### CocoaPods 依赖准备
|
### CocoaPods 依赖准备
|
||||||
|
|
||||||
> 仓库包含示例工程 `ReadViewDemo`,并已提交 `Pods/` 与 `Podfile.lock`。如本地环境未同步,可在仓库根或示例工程目录运行:
|
> 仓库包含示例工程 `ReadViewDemo`,并已提交 `ReadViewDemo/Pods/` 与 `ReadViewDemo/Podfile.lock`。如本地环境未同步,请在示例工程目录运行:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pod install
|
cd ReadViewDemo && pod install
|
||||||
```
|
```
|
||||||
|
|
||||||
(依赖入口:`Podfile`、`ReadViewDemo/Podfile`)
|
(依赖入口:`ReadViewDemo/Podfile`)
|
||||||
|
|
||||||
### 运行 UI 测试
|
### 运行 UI 测试
|
||||||
|
|
||||||
|
|||||||
@@ -1,30 +0,0 @@
|
|||||||
platform :ios, '15.6'
|
|
||||||
use_frameworks!
|
|
||||||
|
|
||||||
workspace 'ReadViewSDK.xcworkspace'
|
|
||||||
project 'ReadViewSDK.xcodeproj'
|
|
||||||
|
|
||||||
target 'ReadViewSDK' do
|
|
||||||
pod 'RDEpubReaderView', :path => '..'
|
|
||||||
end
|
|
||||||
|
|
||||||
post_install do |installer|
|
|
||||||
apply_settings = lambda do |config|
|
|
||||||
config.build_settings['ENABLE_USER_SCRIPT_SANDBOXING'] = 'NO'
|
|
||||||
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '15.6'
|
|
||||||
end
|
|
||||||
|
|
||||||
# Pods project (Pods.xcodeproj)
|
|
||||||
installer.pods_project.build_configurations.each { |c| apply_settings.call(c) }
|
|
||||||
installer.pods_project.targets.each { |t| t.build_configurations.each { |c| apply_settings.call(c) } }
|
|
||||||
|
|
||||||
installer.aggregate_targets.each do |at|
|
|
||||||
p = at.user_project
|
|
||||||
next unless p
|
|
||||||
|
|
||||||
# User project(s) that integrate Pods (e.g. ReadViewDemo / ReadViewSDK)
|
|
||||||
p.build_configurations.each { |c| apply_settings.call(c) }
|
|
||||||
p.targets.each { |t| t.build_configurations.each { |c| apply_settings.call(c) } }
|
|
||||||
p.save
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -3,7 +3,8 @@ platform :ios, '15.6'
|
|||||||
target 'ReadViewDemo' do
|
target 'ReadViewDemo' do
|
||||||
# Comment the next line if you don't want to use dynamic frameworks
|
# Comment the next line if you don't want to use dynamic frameworks
|
||||||
use_frameworks!
|
use_frameworks!
|
||||||
pod 'RDEpubReaderView', :path => '..'
|
pod 'RDEpubReaderView', :path => '../Sources/RDEpubReaderView'
|
||||||
|
pod 'RDPDFReaderView', :path => '../Sources/RDPDFReaderView'
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -16,30 +16,40 @@ PODS:
|
|||||||
- DTFoundation/Core
|
- DTFoundation/Core
|
||||||
- DTFoundation/UIKit (1.7.19):
|
- DTFoundation/UIKit (1.7.19):
|
||||||
- DTFoundation/Core
|
- DTFoundation/Core
|
||||||
- RDEpubReaderView (0.0.1):
|
- RDEpubReaderView (0.0.2):
|
||||||
- DTCoreText (~> 1.6)
|
- DTCoreText (~> 1.6)
|
||||||
|
- SnapKit (~> 5.7)
|
||||||
- ZIPFoundation (~> 0.9)
|
- ZIPFoundation (~> 0.9)
|
||||||
|
- RDPDFReaderView (0.0.1):
|
||||||
|
- SnapKit (~> 5.7)
|
||||||
|
- SnapKit (5.7.1)
|
||||||
- ZIPFoundation (0.9.20)
|
- ZIPFoundation (0.9.20)
|
||||||
|
|
||||||
DEPENDENCIES:
|
DEPENDENCIES:
|
||||||
- RDEpubReaderView (from `..`)
|
- RDEpubReaderView (from `../Sources/RDEpubReaderView`)
|
||||||
|
- RDPDFReaderView (from `../Sources/RDPDFReaderView`)
|
||||||
|
|
||||||
SPEC REPOS:
|
SPEC REPOS:
|
||||||
trunk:
|
trunk:
|
||||||
- DTCoreText
|
- DTCoreText
|
||||||
- DTFoundation
|
- DTFoundation
|
||||||
|
- SnapKit
|
||||||
- ZIPFoundation
|
- ZIPFoundation
|
||||||
|
|
||||||
EXTERNAL SOURCES:
|
EXTERNAL SOURCES:
|
||||||
RDEpubReaderView:
|
RDEpubReaderView:
|
||||||
:path: ".."
|
:path: "../Sources/RDEpubReaderView"
|
||||||
|
RDPDFReaderView:
|
||||||
|
:path: "../Sources/RDPDFReaderView"
|
||||||
|
|
||||||
SPEC CHECKSUMS:
|
SPEC CHECKSUMS:
|
||||||
DTCoreText: 11b7fe2104f476f82e75a4e3dbdde74d7186cecb
|
DTCoreText: 11b7fe2104f476f82e75a4e3dbdde74d7186cecb
|
||||||
DTFoundation: 76b624967cf5bcaae6bb057d622c536c36ef36d0
|
DTFoundation: 76b624967cf5bcaae6bb057d622c536c36ef36d0
|
||||||
RDEpubReaderView: 5ff99b803f5a46e5ff4ebef3024dd217284c69ed
|
RDEpubReaderView: 5a09a7856f04b6f2f8610aa6fd965d35cadb8e17
|
||||||
|
RDPDFReaderView: f7c2d0ea7c129aa4ab15ae7f9daad2974573d749
|
||||||
|
SnapKit: d612e99e678a2d3b95bf60b0705ed0a35c03484a
|
||||||
ZIPFoundation: dfd3d681c4053ff7e2f7350bc4e53b5dba3f5351
|
ZIPFoundation: dfd3d681c4053ff7e2f7350bc4e53b5dba3f5351
|
||||||
|
|
||||||
PODFILE CHECKSUM: adda84af3e8577b2a99d5b2cecf381511352f0bd
|
PODFILE CHECKSUM: c39db27dbc9c6a96a33f22e78ce1b22dcd48d75f
|
||||||
|
|
||||||
COCOAPODS: 1.16.2
|
COCOAPODS: 1.16.2
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"name": "RDEpubReaderView",
|
"name": "RDEpubReaderView",
|
||||||
"module_name": "RDEpubReaderView",
|
"module_name": "RDEpubReaderView",
|
||||||
"version": "0.0.1",
|
"version": "0.0.2",
|
||||||
"summary": "A reader view for EPUB and plain-text books",
|
"summary": "A reader view for EPUB, TXT, MOBI, and CBZ books",
|
||||||
"platforms": {
|
"platforms": {
|
||||||
"ios": "15.0"
|
"ios": "15.0"
|
||||||
},
|
},
|
||||||
@@ -15,13 +15,13 @@
|
|||||||
},
|
},
|
||||||
"source": {
|
"source": {
|
||||||
"git": "http://192.168.21.200:8418/4v5u09Z5a4Yuc/ReadViewSDK.git",
|
"git": "http://192.168.21.200:8418/4v5u09Z5a4Yuc/ReadViewSDK.git",
|
||||||
"tag": "0.0.1"
|
"tag": "0.0.2"
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"source_files": "Sources/RDEpubReaderView/**/*.{swift}",
|
"source_files": "**/*.swift",
|
||||||
"resource_bundles": {
|
"resource_bundles": {
|
||||||
"RDEpubReaderViewAssets": [
|
"RDEpubReaderViewAssets": [
|
||||||
"Sources/RDEpubReaderView/EPUBCore/Resources/**/*"
|
"EPUBCore/Resources/**/*"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -30,6 +30,9 @@
|
|||||||
],
|
],
|
||||||
"DTCoreText": [
|
"DTCoreText": [
|
||||||
"~> 1.6"
|
"~> 1.6"
|
||||||
|
],
|
||||||
|
"SnapKit": [
|
||||||
|
"~> 5.7"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"requires_arc": true,
|
"requires_arc": true,
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
{
|
||||||
|
"name": "RDPDFReaderView",
|
||||||
|
"module_name": "RDPDFReaderView",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"summary": "UIKit PDF reader supporting host images and direct PDFKit parsing",
|
||||||
|
"platforms": {
|
||||||
|
"ios": "15.0"
|
||||||
|
},
|
||||||
|
"swift_versions": [
|
||||||
|
"5.10"
|
||||||
|
],
|
||||||
|
"homepage": "https://example.invalid/RDPDFReaderView",
|
||||||
|
"authors": {
|
||||||
|
"readoor": "ios@touchread.com"
|
||||||
|
},
|
||||||
|
"source": {
|
||||||
|
"path": "."
|
||||||
|
},
|
||||||
|
"license": "MIT",
|
||||||
|
"source_files": "{Sources,ReaderView}/**/*.swift",
|
||||||
|
"dependencies": {
|
||||||
|
"SnapKit": [
|
||||||
|
"~> 5.7"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"frameworks": [
|
||||||
|
"Vision",
|
||||||
|
"CoreImage",
|
||||||
|
"PDFKit"
|
||||||
|
],
|
||||||
|
"requires_arc": true,
|
||||||
|
"swift_version": "5.10"
|
||||||
|
}
|
||||||
Generated
+15
-5
@@ -16,30 +16,40 @@ PODS:
|
|||||||
- DTFoundation/Core
|
- DTFoundation/Core
|
||||||
- DTFoundation/UIKit (1.7.19):
|
- DTFoundation/UIKit (1.7.19):
|
||||||
- DTFoundation/Core
|
- DTFoundation/Core
|
||||||
- RDEpubReaderView (0.0.1):
|
- RDEpubReaderView (0.0.2):
|
||||||
- DTCoreText (~> 1.6)
|
- DTCoreText (~> 1.6)
|
||||||
|
- SnapKit (~> 5.7)
|
||||||
- ZIPFoundation (~> 0.9)
|
- ZIPFoundation (~> 0.9)
|
||||||
|
- RDPDFReaderView (0.0.1):
|
||||||
|
- SnapKit (~> 5.7)
|
||||||
|
- SnapKit (5.7.1)
|
||||||
- ZIPFoundation (0.9.20)
|
- ZIPFoundation (0.9.20)
|
||||||
|
|
||||||
DEPENDENCIES:
|
DEPENDENCIES:
|
||||||
- RDEpubReaderView (from `..`)
|
- RDEpubReaderView (from `../Sources/RDEpubReaderView`)
|
||||||
|
- RDPDFReaderView (from `../Sources/RDPDFReaderView`)
|
||||||
|
|
||||||
SPEC REPOS:
|
SPEC REPOS:
|
||||||
trunk:
|
trunk:
|
||||||
- DTCoreText
|
- DTCoreText
|
||||||
- DTFoundation
|
- DTFoundation
|
||||||
|
- SnapKit
|
||||||
- ZIPFoundation
|
- ZIPFoundation
|
||||||
|
|
||||||
EXTERNAL SOURCES:
|
EXTERNAL SOURCES:
|
||||||
RDEpubReaderView:
|
RDEpubReaderView:
|
||||||
:path: ".."
|
:path: "../Sources/RDEpubReaderView"
|
||||||
|
RDPDFReaderView:
|
||||||
|
:path: "../Sources/RDPDFReaderView"
|
||||||
|
|
||||||
SPEC CHECKSUMS:
|
SPEC CHECKSUMS:
|
||||||
DTCoreText: 11b7fe2104f476f82e75a4e3dbdde74d7186cecb
|
DTCoreText: 11b7fe2104f476f82e75a4e3dbdde74d7186cecb
|
||||||
DTFoundation: 76b624967cf5bcaae6bb057d622c536c36ef36d0
|
DTFoundation: 76b624967cf5bcaae6bb057d622c536c36ef36d0
|
||||||
RDEpubReaderView: 5ff99b803f5a46e5ff4ebef3024dd217284c69ed
|
RDEpubReaderView: 5a09a7856f04b6f2f8610aa6fd965d35cadb8e17
|
||||||
|
RDPDFReaderView: f7c2d0ea7c129aa4ab15ae7f9daad2974573d749
|
||||||
|
SnapKit: d612e99e678a2d3b95bf60b0705ed0a35c03484a
|
||||||
ZIPFoundation: dfd3d681c4053ff7e2f7350bc4e53b5dba3f5351
|
ZIPFoundation: dfd3d681c4053ff7e2f7350bc4e53b5dba3f5351
|
||||||
|
|
||||||
PODFILE CHECKSUM: adda84af3e8577b2a99d5b2cecf381511352f0bd
|
PODFILE CHECKSUM: c39db27dbc9c6a96a33f22e78ce1b22dcd48d75f
|
||||||
|
|
||||||
COCOAPODS: 1.16.2
|
COCOAPODS: 1.16.2
|
||||||
|
|||||||
+3201
-2337
File diff suppressed because it is too large
Load Diff
Generated
+19
@@ -0,0 +1,19 @@
|
|||||||
|
Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
Generated
+155
@@ -0,0 +1,155 @@
|
|||||||
|
<img src="https://snapkit.github.io/SnapKit/images/banner.jpg" alt="" />
|
||||||
|
|
||||||
|
SnapKit is a DSL to make Auto Layout easy on both iOS and OS X.
|
||||||
|
|
||||||
|
[](https://travis-ci.org/SnapKit/SnapKit)
|
||||||
|
[](https://github.com/SnapKit/SnapKit)
|
||||||
|
[](https://cocoapods.org/pods/SnapKit)
|
||||||
|
[](https://github.com/Carthage/Carthage)
|
||||||
|
|
||||||
|
#### ⚠️ **To use with Swift 4.x please ensure you are using >= 4.0.0** ⚠️
|
||||||
|
#### ⚠️ **To use with Swift 5.x please ensure you are using >= 5.0.0** ⚠️
|
||||||
|
|
||||||
|
## Contents
|
||||||
|
|
||||||
|
- [Requirements](#requirements)
|
||||||
|
- [Migration Guides](#migration-guides)
|
||||||
|
- [Communication](#communication)
|
||||||
|
- [Installation](#installation)
|
||||||
|
- [Usage](#usage)
|
||||||
|
- [Credits](#credits)
|
||||||
|
- [License](#license)
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
- iOS 12.0+ / Mac OS X 10.13+ / tvOS 10.0+
|
||||||
|
- Xcode 10.0+
|
||||||
|
- Swift 4.0+
|
||||||
|
|
||||||
|
## Migration Guides
|
||||||
|
|
||||||
|
- [SnapKit 3.0 Migration Guide](Documentation/SnapKit%203.0%20Migration%20Guide.md)
|
||||||
|
|
||||||
|
## Communication
|
||||||
|
|
||||||
|
- If you **need help**, use [Stack Overflow](http://stackoverflow.com/questions/tagged/snapkit). (Tag 'snapkit')
|
||||||
|
- If you'd like to **ask a general question**, use [Stack Overflow](http://stackoverflow.com/questions/tagged/snapkit).
|
||||||
|
- If you **found a bug**, open an issue.
|
||||||
|
- If you **have a feature request**, open an issue.
|
||||||
|
- If you **want to contribute**, submit a pull request.
|
||||||
|
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
### CocoaPods
|
||||||
|
|
||||||
|
[CocoaPods](http://cocoapods.org) is a dependency manager for Cocoa projects. You can install it with the following command:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ gem install cocoapods
|
||||||
|
```
|
||||||
|
|
||||||
|
> CocoaPods 1.1.0+ is required to build SnapKit 4.0.0+.
|
||||||
|
|
||||||
|
To integrate SnapKit into your Xcode project using CocoaPods, specify it in your `Podfile`:
|
||||||
|
|
||||||
|
```ruby
|
||||||
|
source 'https://github.com/CocoaPods/Specs.git'
|
||||||
|
platform :ios, '10.0'
|
||||||
|
use_frameworks!
|
||||||
|
|
||||||
|
target '<Your Target Name>' do
|
||||||
|
pod 'SnapKit', '~> 5.7.0'
|
||||||
|
end
|
||||||
|
```
|
||||||
|
|
||||||
|
Then, run the following command:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ pod install
|
||||||
|
```
|
||||||
|
|
||||||
|
### Carthage
|
||||||
|
|
||||||
|
[Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.
|
||||||
|
|
||||||
|
You can install Carthage with [Homebrew](http://brew.sh/) using the following command:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew update
|
||||||
|
$ brew install carthage
|
||||||
|
```
|
||||||
|
|
||||||
|
To integrate SnapKit into your Xcode project using Carthage, specify it in your `Cartfile`:
|
||||||
|
|
||||||
|
```ogdl
|
||||||
|
github "SnapKit/SnapKit" ~> 5.0.0
|
||||||
|
```
|
||||||
|
|
||||||
|
Run `carthage update` to build the framework and drag the built `SnapKit.framework` into your Xcode project.
|
||||||
|
|
||||||
|
### Swift Package Manager
|
||||||
|
|
||||||
|
[Swift Package Manager](https://swift.org/package-manager/) is a tool for managing the distribution of Swift code. It’s integrated with the Swift build system to automate the process of downloading, compiling, and linking dependencies.
|
||||||
|
|
||||||
|
> Xcode 11+ is required to build SnapKit using Swift Package Manager.
|
||||||
|
|
||||||
|
To integrate SnapKit into your Xcode project using Swift Package Manager, add it to the dependencies value of your `Package.swift`:
|
||||||
|
|
||||||
|
```swift
|
||||||
|
dependencies: [
|
||||||
|
.package(url: "https://github.com/SnapKit/SnapKit.git", .upToNextMajor(from: "5.0.1"))
|
||||||
|
]
|
||||||
|
```
|
||||||
|
|
||||||
|
### Manually
|
||||||
|
|
||||||
|
If you prefer not to use either of the aforementioned dependency managers, you can integrate SnapKit into your project manually.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
### Quick Start
|
||||||
|
|
||||||
|
```swift
|
||||||
|
import SnapKit
|
||||||
|
|
||||||
|
class MyViewController: UIViewController {
|
||||||
|
|
||||||
|
lazy var box = UIView()
|
||||||
|
|
||||||
|
override func viewDidLoad() {
|
||||||
|
super.viewDidLoad()
|
||||||
|
|
||||||
|
self.view.addSubview(box)
|
||||||
|
box.backgroundColor = .green
|
||||||
|
box.snp.makeConstraints { (make) -> Void in
|
||||||
|
make.width.height.equalTo(50)
|
||||||
|
make.center.equalTo(self.view)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Playground
|
||||||
|
You can try SnapKit in Playground.
|
||||||
|
|
||||||
|
**Note:**
|
||||||
|
|
||||||
|
> To try SnapKit in playground, open `SnapKit.xcworkspace` and build SnapKit.framework for any simulator first.
|
||||||
|
|
||||||
|
### Resources
|
||||||
|
|
||||||
|
- [Documentation](https://snapkit.github.io/SnapKit/docs/)
|
||||||
|
- [F.A.Q.](https://snapkit.github.io/SnapKit/faq/)
|
||||||
|
|
||||||
|
## Credits
|
||||||
|
|
||||||
|
- Robert Payne ([@robertjpayne](https://twitter.com/robertjpayne))
|
||||||
|
- Many other contributors
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
SnapKit is released under the MIT license. See LICENSE for details.
|
||||||
+341
@@ -0,0 +1,341 @@
|
|||||||
|
//
|
||||||
|
// SnapKit
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
|
||||||
|
#if canImport(UIKit)
|
||||||
|
import UIKit
|
||||||
|
#else
|
||||||
|
import AppKit
|
||||||
|
#endif
|
||||||
|
|
||||||
|
public final class Constraint {
|
||||||
|
|
||||||
|
internal let sourceLocation: (String, UInt)
|
||||||
|
internal let label: String?
|
||||||
|
|
||||||
|
private let from: ConstraintItem
|
||||||
|
private let to: ConstraintItem
|
||||||
|
private let relation: ConstraintRelation
|
||||||
|
private let multiplier: ConstraintMultiplierTarget
|
||||||
|
private var constant: ConstraintConstantTarget {
|
||||||
|
didSet {
|
||||||
|
self.updateConstantAndPriorityIfNeeded()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private var priority: ConstraintPriorityTarget {
|
||||||
|
didSet {
|
||||||
|
self.updateConstantAndPriorityIfNeeded()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public var layoutConstraints: [LayoutConstraint]
|
||||||
|
|
||||||
|
public var isActive: Bool {
|
||||||
|
set {
|
||||||
|
if newValue {
|
||||||
|
activate()
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
deactivate()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
get {
|
||||||
|
for layoutConstraint in self.layoutConstraints {
|
||||||
|
if layoutConstraint.isActive {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: Initialization
|
||||||
|
|
||||||
|
internal init(from: ConstraintItem,
|
||||||
|
to: ConstraintItem,
|
||||||
|
relation: ConstraintRelation,
|
||||||
|
sourceLocation: (String, UInt),
|
||||||
|
label: String?,
|
||||||
|
multiplier: ConstraintMultiplierTarget,
|
||||||
|
constant: ConstraintConstantTarget,
|
||||||
|
priority: ConstraintPriorityTarget) {
|
||||||
|
self.from = from
|
||||||
|
self.to = to
|
||||||
|
self.relation = relation
|
||||||
|
self.sourceLocation = sourceLocation
|
||||||
|
self.label = label
|
||||||
|
self.multiplier = multiplier
|
||||||
|
self.constant = constant
|
||||||
|
self.priority = priority
|
||||||
|
self.layoutConstraints = []
|
||||||
|
|
||||||
|
// get attributes
|
||||||
|
let layoutFromAttributes = self.from.attributes.layoutAttributes
|
||||||
|
let layoutToAttributes = self.to.attributes.layoutAttributes
|
||||||
|
|
||||||
|
// get layout from
|
||||||
|
let layoutFrom = self.from.layoutConstraintItem!
|
||||||
|
|
||||||
|
// get relation
|
||||||
|
let layoutRelation = self.relation.layoutRelation
|
||||||
|
|
||||||
|
for layoutFromAttribute in layoutFromAttributes {
|
||||||
|
// get layout to attribute
|
||||||
|
let layoutToAttribute: LayoutAttribute
|
||||||
|
#if canImport(UIKit)
|
||||||
|
if layoutToAttributes.count > 0 {
|
||||||
|
if self.from.attributes == .edges && self.to.attributes == .margins {
|
||||||
|
switch layoutFromAttribute {
|
||||||
|
case .left:
|
||||||
|
layoutToAttribute = .leftMargin
|
||||||
|
case .right:
|
||||||
|
layoutToAttribute = .rightMargin
|
||||||
|
case .top:
|
||||||
|
layoutToAttribute = .topMargin
|
||||||
|
case .bottom:
|
||||||
|
layoutToAttribute = .bottomMargin
|
||||||
|
default:
|
||||||
|
fatalError()
|
||||||
|
}
|
||||||
|
} else if self.from.attributes == .margins && self.to.attributes == .edges {
|
||||||
|
switch layoutFromAttribute {
|
||||||
|
case .leftMargin:
|
||||||
|
layoutToAttribute = .left
|
||||||
|
case .rightMargin:
|
||||||
|
layoutToAttribute = .right
|
||||||
|
case .topMargin:
|
||||||
|
layoutToAttribute = .top
|
||||||
|
case .bottomMargin:
|
||||||
|
layoutToAttribute = .bottom
|
||||||
|
default:
|
||||||
|
fatalError()
|
||||||
|
}
|
||||||
|
} else if self.from.attributes == .directionalEdges && self.to.attributes == .directionalMargins {
|
||||||
|
switch layoutFromAttribute {
|
||||||
|
case .leading:
|
||||||
|
layoutToAttribute = .leadingMargin
|
||||||
|
case .trailing:
|
||||||
|
layoutToAttribute = .trailingMargin
|
||||||
|
case .top:
|
||||||
|
layoutToAttribute = .topMargin
|
||||||
|
case .bottom:
|
||||||
|
layoutToAttribute = .bottomMargin
|
||||||
|
default:
|
||||||
|
fatalError()
|
||||||
|
}
|
||||||
|
} else if self.from.attributes == .directionalMargins && self.to.attributes == .directionalEdges {
|
||||||
|
switch layoutFromAttribute {
|
||||||
|
case .leadingMargin:
|
||||||
|
layoutToAttribute = .leading
|
||||||
|
case .trailingMargin:
|
||||||
|
layoutToAttribute = .trailing
|
||||||
|
case .topMargin:
|
||||||
|
layoutToAttribute = .top
|
||||||
|
case .bottomMargin:
|
||||||
|
layoutToAttribute = .bottom
|
||||||
|
default:
|
||||||
|
fatalError()
|
||||||
|
}
|
||||||
|
} else if self.from.attributes == self.to.attributes {
|
||||||
|
layoutToAttribute = layoutFromAttribute
|
||||||
|
} else {
|
||||||
|
layoutToAttribute = layoutToAttributes[0]
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if self.to.target == nil && (layoutFromAttribute == .centerX || layoutFromAttribute == .centerY) {
|
||||||
|
layoutToAttribute = layoutFromAttribute == .centerX ? .left : .top
|
||||||
|
} else {
|
||||||
|
layoutToAttribute = layoutFromAttribute
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
if self.from.attributes == self.to.attributes {
|
||||||
|
layoutToAttribute = layoutFromAttribute
|
||||||
|
} else if layoutToAttributes.count > 0 {
|
||||||
|
layoutToAttribute = layoutToAttributes[0]
|
||||||
|
} else {
|
||||||
|
layoutToAttribute = layoutFromAttribute
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// get layout constant
|
||||||
|
let layoutConstant: CGFloat = self.constant.constraintConstantTargetValueFor(layoutAttribute: layoutToAttribute)
|
||||||
|
|
||||||
|
// get layout to
|
||||||
|
var layoutTo: AnyObject? = self.to.target
|
||||||
|
|
||||||
|
// use superview if possible
|
||||||
|
if layoutTo == nil && layoutToAttribute != .width && layoutToAttribute != .height {
|
||||||
|
layoutTo = layoutFrom.superview
|
||||||
|
}
|
||||||
|
|
||||||
|
// create layout constraint
|
||||||
|
let layoutConstraint = LayoutConstraint(
|
||||||
|
item: layoutFrom,
|
||||||
|
attribute: layoutFromAttribute,
|
||||||
|
relatedBy: layoutRelation,
|
||||||
|
toItem: layoutTo,
|
||||||
|
attribute: layoutToAttribute,
|
||||||
|
multiplier: self.multiplier.constraintMultiplierTargetValue,
|
||||||
|
constant: layoutConstant
|
||||||
|
)
|
||||||
|
|
||||||
|
// set label
|
||||||
|
layoutConstraint.label = self.label
|
||||||
|
|
||||||
|
// set priority
|
||||||
|
layoutConstraint.priority = LayoutPriority(rawValue: self.priority.constraintPriorityTargetValue)
|
||||||
|
|
||||||
|
// set constraint
|
||||||
|
layoutConstraint.constraint = self
|
||||||
|
|
||||||
|
// append
|
||||||
|
self.layoutConstraints.append(layoutConstraint)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: Public
|
||||||
|
|
||||||
|
@available(*, deprecated, renamed:"activate()")
|
||||||
|
public func install() {
|
||||||
|
self.activate()
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(*, deprecated, renamed:"deactivate()")
|
||||||
|
public func uninstall() {
|
||||||
|
self.deactivate()
|
||||||
|
}
|
||||||
|
|
||||||
|
public func activate() {
|
||||||
|
self.activateIfNeeded()
|
||||||
|
}
|
||||||
|
|
||||||
|
public func deactivate() {
|
||||||
|
self.deactivateIfNeeded()
|
||||||
|
}
|
||||||
|
|
||||||
|
@discardableResult
|
||||||
|
public func update(offset: ConstraintOffsetTarget) -> Constraint {
|
||||||
|
self.constant = offset.constraintOffsetTargetValue
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
@discardableResult
|
||||||
|
public func update(inset: ConstraintInsetTarget) -> Constraint {
|
||||||
|
self.constant = inset.constraintInsetTargetValue
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
#if canImport(UIKit)
|
||||||
|
@discardableResult
|
||||||
|
@available(iOS 11.0, tvOS 11.0, *)
|
||||||
|
public func update(inset: ConstraintDirectionalInsetTarget) -> Constraint {
|
||||||
|
self.constant = inset.constraintDirectionalInsetTargetValue
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
@discardableResult
|
||||||
|
public func update(priority: ConstraintPriorityTarget) -> Constraint {
|
||||||
|
self.priority = priority.constraintPriorityTargetValue
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
@discardableResult
|
||||||
|
public func update(priority: ConstraintPriority) -> Constraint {
|
||||||
|
self.priority = priority.value
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(*, deprecated, renamed:"update(offset:)")
|
||||||
|
public func updateOffset(amount: ConstraintOffsetTarget) -> Void { self.update(offset: amount) }
|
||||||
|
|
||||||
|
@available(*, deprecated, renamed:"update(inset:)")
|
||||||
|
public func updateInsets(amount: ConstraintInsetTarget) -> Void { self.update(inset: amount) }
|
||||||
|
|
||||||
|
@available(*, deprecated, renamed:"update(priority:)")
|
||||||
|
public func updatePriority(amount: ConstraintPriorityTarget) -> Void { self.update(priority: amount) }
|
||||||
|
|
||||||
|
@available(*, deprecated, message:"Use update(priority: ConstraintPriorityTarget) instead.")
|
||||||
|
public func updatePriorityRequired() -> Void {}
|
||||||
|
|
||||||
|
@available(*, deprecated, message:"Use update(priority: ConstraintPriorityTarget) instead.")
|
||||||
|
public func updatePriorityHigh() -> Void { fatalError("Must be implemented by Concrete subclass.") }
|
||||||
|
|
||||||
|
@available(*, deprecated, message:"Use update(priority: ConstraintPriorityTarget) instead.")
|
||||||
|
public func updatePriorityMedium() -> Void { fatalError("Must be implemented by Concrete subclass.") }
|
||||||
|
|
||||||
|
@available(*, deprecated, message:"Use update(priority: ConstraintPriorityTarget) instead.")
|
||||||
|
public func updatePriorityLow() -> Void { fatalError("Must be implemented by Concrete subclass.") }
|
||||||
|
|
||||||
|
// MARK: Internal
|
||||||
|
|
||||||
|
internal func updateConstantAndPriorityIfNeeded() {
|
||||||
|
for layoutConstraint in self.layoutConstraints {
|
||||||
|
let attribute = (layoutConstraint.secondAttribute == .notAnAttribute) ? layoutConstraint.firstAttribute : layoutConstraint.secondAttribute
|
||||||
|
layoutConstraint.constant = self.constant.constraintConstantTargetValueFor(layoutAttribute: attribute)
|
||||||
|
|
||||||
|
let requiredPriority = ConstraintPriority.required.value
|
||||||
|
if (layoutConstraint.priority.rawValue < requiredPriority), (self.priority.constraintPriorityTargetValue != requiredPriority) {
|
||||||
|
layoutConstraint.priority = LayoutPriority(rawValue: self.priority.constraintPriorityTargetValue)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal func activateIfNeeded(updatingExisting: Bool = false) {
|
||||||
|
guard let item = self.from.layoutConstraintItem else {
|
||||||
|
print("WARNING: SnapKit failed to get from item from constraint. Activate will be a no-op.")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let layoutConstraints = self.layoutConstraints
|
||||||
|
|
||||||
|
if updatingExisting {
|
||||||
|
var existingLayoutConstraints: [LayoutConstraint] = []
|
||||||
|
for constraint in item.constraints {
|
||||||
|
existingLayoutConstraints += constraint.layoutConstraints
|
||||||
|
}
|
||||||
|
|
||||||
|
for layoutConstraint in layoutConstraints {
|
||||||
|
let existingLayoutConstraint = existingLayoutConstraints.first { $0 == layoutConstraint }
|
||||||
|
guard let updateLayoutConstraint = existingLayoutConstraint else {
|
||||||
|
fatalError("Updated constraint could not find existing matching constraint to update: \(layoutConstraint)")
|
||||||
|
}
|
||||||
|
|
||||||
|
let updateLayoutAttribute = (updateLayoutConstraint.secondAttribute == .notAnAttribute) ? updateLayoutConstraint.firstAttribute : updateLayoutConstraint.secondAttribute
|
||||||
|
updateLayoutConstraint.constant = self.constant.constraintConstantTargetValueFor(layoutAttribute: updateLayoutAttribute)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
NSLayoutConstraint.activate(layoutConstraints)
|
||||||
|
item.add(constraints: [self])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal func deactivateIfNeeded() {
|
||||||
|
guard let item = self.from.layoutConstraintItem else {
|
||||||
|
print("WARNING: SnapKit failed to get from item from constraint. Deactivate will be a no-op.")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let layoutConstraints = self.layoutConstraints
|
||||||
|
NSLayoutConstraint.deactivate(layoutConstraints)
|
||||||
|
item.remove(constraints: [self])
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,203 @@
|
|||||||
|
//
|
||||||
|
// SnapKit
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
|
||||||
|
#if canImport(UIKit)
|
||||||
|
import UIKit
|
||||||
|
#else
|
||||||
|
import AppKit
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
internal struct ConstraintAttributes : OptionSet, ExpressibleByIntegerLiteral {
|
||||||
|
|
||||||
|
typealias IntegerLiteralType = UInt
|
||||||
|
|
||||||
|
internal init(rawValue: UInt) {
|
||||||
|
self.rawValue = rawValue
|
||||||
|
}
|
||||||
|
internal init(_ rawValue: UInt) {
|
||||||
|
self.init(rawValue: rawValue)
|
||||||
|
}
|
||||||
|
internal init(nilLiteral: ()) {
|
||||||
|
self.rawValue = 0
|
||||||
|
}
|
||||||
|
internal init(integerLiteral rawValue: IntegerLiteralType) {
|
||||||
|
self.init(rawValue: rawValue)
|
||||||
|
}
|
||||||
|
|
||||||
|
internal private(set) var rawValue: UInt
|
||||||
|
internal static var allZeros: ConstraintAttributes { return 0 }
|
||||||
|
internal static func convertFromNilLiteral() -> ConstraintAttributes { return 0 }
|
||||||
|
internal var boolValue: Bool { return self.rawValue != 0 }
|
||||||
|
|
||||||
|
internal func toRaw() -> UInt { return self.rawValue }
|
||||||
|
internal static func fromRaw(_ raw: UInt) -> ConstraintAttributes? { return self.init(raw) }
|
||||||
|
internal static func fromMask(_ raw: UInt) -> ConstraintAttributes { return self.init(raw) }
|
||||||
|
|
||||||
|
// normal
|
||||||
|
|
||||||
|
internal static let none: ConstraintAttributes = 0
|
||||||
|
internal static let left: ConstraintAttributes = ConstraintAttributes(UInt(1) << 0)
|
||||||
|
internal static let top: ConstraintAttributes = ConstraintAttributes(UInt(1) << 1)
|
||||||
|
internal static let right: ConstraintAttributes = ConstraintAttributes(UInt(1) << 2)
|
||||||
|
internal static let bottom: ConstraintAttributes = ConstraintAttributes(UInt(1) << 3)
|
||||||
|
internal static let leading: ConstraintAttributes = ConstraintAttributes(UInt(1) << 4)
|
||||||
|
internal static let trailing: ConstraintAttributes = ConstraintAttributes(UInt(1) << 5)
|
||||||
|
internal static let width: ConstraintAttributes = ConstraintAttributes(UInt(1) << 6)
|
||||||
|
internal static let height: ConstraintAttributes = ConstraintAttributes(UInt(1) << 7)
|
||||||
|
internal static let centerX: ConstraintAttributes = ConstraintAttributes(UInt(1) << 8)
|
||||||
|
internal static let centerY: ConstraintAttributes = ConstraintAttributes(UInt(1) << 9)
|
||||||
|
internal static let lastBaseline: ConstraintAttributes = ConstraintAttributes(UInt(1) << 10)
|
||||||
|
|
||||||
|
@available(iOS 8.0, OSX 10.11, *)
|
||||||
|
internal static let firstBaseline: ConstraintAttributes = ConstraintAttributes(UInt(1) << 11)
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
internal static let leftMargin: ConstraintAttributes = ConstraintAttributes(UInt(1) << 12)
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
internal static let rightMargin: ConstraintAttributes = ConstraintAttributes(UInt(1) << 13)
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
internal static let topMargin: ConstraintAttributes = ConstraintAttributes(UInt(1) << 14)
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
internal static let bottomMargin: ConstraintAttributes = ConstraintAttributes(UInt(1) << 15)
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
internal static let leadingMargin: ConstraintAttributes = ConstraintAttributes(UInt(1) << 16)
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
internal static let trailingMargin: ConstraintAttributes = ConstraintAttributes(UInt(1) << 17)
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
internal static let centerXWithinMargins: ConstraintAttributes = ConstraintAttributes(UInt(1) << 18)
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
internal static let centerYWithinMargins: ConstraintAttributes = ConstraintAttributes(UInt(1) << 19)
|
||||||
|
|
||||||
|
// aggregates
|
||||||
|
|
||||||
|
internal static let edges: ConstraintAttributes = [.horizontalEdges, .verticalEdges]
|
||||||
|
internal static let horizontalEdges: ConstraintAttributes = [.left, .right]
|
||||||
|
internal static let verticalEdges: ConstraintAttributes = [.top, .bottom]
|
||||||
|
internal static let directionalEdges: ConstraintAttributes = [.directionalHorizontalEdges, .directionalVerticalEdges]
|
||||||
|
internal static let directionalHorizontalEdges: ConstraintAttributes = [.leading, .trailing]
|
||||||
|
internal static let directionalVerticalEdges: ConstraintAttributes = [.top, .bottom]
|
||||||
|
internal static let size: ConstraintAttributes = [.width, .height]
|
||||||
|
internal static let center: ConstraintAttributes = [.centerX, .centerY]
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
internal static let margins: ConstraintAttributes = [.leftMargin, .topMargin, .rightMargin, .bottomMargin]
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
internal static let directionalMargins: ConstraintAttributes = [.leadingMargin, .topMargin, .trailingMargin, .bottomMargin]
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
internal static let centerWithinMargins: ConstraintAttributes = [.centerXWithinMargins, .centerYWithinMargins]
|
||||||
|
|
||||||
|
internal var layoutAttributes:[LayoutAttribute] {
|
||||||
|
var attrs = [LayoutAttribute]()
|
||||||
|
if (self.contains(ConstraintAttributes.left)) {
|
||||||
|
attrs.append(.left)
|
||||||
|
}
|
||||||
|
if (self.contains(ConstraintAttributes.top)) {
|
||||||
|
attrs.append(.top)
|
||||||
|
}
|
||||||
|
if (self.contains(ConstraintAttributes.right)) {
|
||||||
|
attrs.append(.right)
|
||||||
|
}
|
||||||
|
if (self.contains(ConstraintAttributes.bottom)) {
|
||||||
|
attrs.append(.bottom)
|
||||||
|
}
|
||||||
|
if (self.contains(ConstraintAttributes.leading)) {
|
||||||
|
attrs.append(.leading)
|
||||||
|
}
|
||||||
|
if (self.contains(ConstraintAttributes.trailing)) {
|
||||||
|
attrs.append(.trailing)
|
||||||
|
}
|
||||||
|
if (self.contains(ConstraintAttributes.width)) {
|
||||||
|
attrs.append(.width)
|
||||||
|
}
|
||||||
|
if (self.contains(ConstraintAttributes.height)) {
|
||||||
|
attrs.append(.height)
|
||||||
|
}
|
||||||
|
if (self.contains(ConstraintAttributes.centerX)) {
|
||||||
|
attrs.append(.centerX)
|
||||||
|
}
|
||||||
|
if (self.contains(ConstraintAttributes.centerY)) {
|
||||||
|
attrs.append(.centerY)
|
||||||
|
}
|
||||||
|
if (self.contains(ConstraintAttributes.lastBaseline)) {
|
||||||
|
attrs.append(.lastBaseline)
|
||||||
|
}
|
||||||
|
|
||||||
|
#if canImport(UIKit)
|
||||||
|
if (self.contains(ConstraintAttributes.firstBaseline)) {
|
||||||
|
attrs.append(.firstBaseline)
|
||||||
|
}
|
||||||
|
if (self.contains(ConstraintAttributes.leftMargin)) {
|
||||||
|
attrs.append(.leftMargin)
|
||||||
|
}
|
||||||
|
if (self.contains(ConstraintAttributes.rightMargin)) {
|
||||||
|
attrs.append(.rightMargin)
|
||||||
|
}
|
||||||
|
if (self.contains(ConstraintAttributes.topMargin)) {
|
||||||
|
attrs.append(.topMargin)
|
||||||
|
}
|
||||||
|
if (self.contains(ConstraintAttributes.bottomMargin)) {
|
||||||
|
attrs.append(.bottomMargin)
|
||||||
|
}
|
||||||
|
if (self.contains(ConstraintAttributes.leadingMargin)) {
|
||||||
|
attrs.append(.leadingMargin)
|
||||||
|
}
|
||||||
|
if (self.contains(ConstraintAttributes.trailingMargin)) {
|
||||||
|
attrs.append(.trailingMargin)
|
||||||
|
}
|
||||||
|
if (self.contains(ConstraintAttributes.centerXWithinMargins)) {
|
||||||
|
attrs.append(.centerXWithinMargins)
|
||||||
|
}
|
||||||
|
if (self.contains(ConstraintAttributes.centerYWithinMargins)) {
|
||||||
|
attrs.append(.centerYWithinMargins)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return attrs
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal func + (left: ConstraintAttributes, right: ConstraintAttributes) -> ConstraintAttributes {
|
||||||
|
return left.union(right)
|
||||||
|
}
|
||||||
|
|
||||||
|
internal func +=(left: inout ConstraintAttributes, right: ConstraintAttributes) {
|
||||||
|
left.formUnion(right)
|
||||||
|
}
|
||||||
|
|
||||||
|
internal func -=(left: inout ConstraintAttributes, right: ConstraintAttributes) {
|
||||||
|
left.subtract(right)
|
||||||
|
}
|
||||||
|
|
||||||
|
internal func ==(left: ConstraintAttributes, right: ConstraintAttributes) -> Bool {
|
||||||
|
return left.rawValue == right.rawValue
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
//
|
||||||
|
// SnapKit
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
|
||||||
|
#if canImport(UIKit)
|
||||||
|
import UIKit
|
||||||
|
public typealias ConstraintInterfaceLayoutDirection = UIUserInterfaceLayoutDirection
|
||||||
|
#else
|
||||||
|
import AppKit
|
||||||
|
public typealias ConstraintInterfaceLayoutDirection = NSUserInterfaceLayoutDirection
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
public struct ConstraintConfig {
|
||||||
|
|
||||||
|
public static var interfaceLayoutDirection: ConstraintInterfaceLayoutDirection = .leftToRight
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,213 @@
|
|||||||
|
//
|
||||||
|
// SnapKit
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
|
||||||
|
#if canImport(UIKit)
|
||||||
|
import UIKit
|
||||||
|
#else
|
||||||
|
import AppKit
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
public protocol ConstraintConstantTarget {
|
||||||
|
}
|
||||||
|
|
||||||
|
extension CGPoint: ConstraintConstantTarget {
|
||||||
|
}
|
||||||
|
|
||||||
|
extension CGSize: ConstraintConstantTarget {
|
||||||
|
}
|
||||||
|
|
||||||
|
extension ConstraintInsets: ConstraintConstantTarget {
|
||||||
|
}
|
||||||
|
|
||||||
|
#if canImport(UIKit)
|
||||||
|
@available(iOS 11.0, tvOS 11.0, *)
|
||||||
|
extension ConstraintDirectionalInsets: ConstraintConstantTarget {
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extension ConstraintConstantTarget {
|
||||||
|
|
||||||
|
internal func constraintConstantTargetValueFor(layoutAttribute: LayoutAttribute) -> CGFloat {
|
||||||
|
if let value = self as? CGFloat {
|
||||||
|
return value
|
||||||
|
}
|
||||||
|
|
||||||
|
if let value = self as? Float {
|
||||||
|
return CGFloat(value)
|
||||||
|
}
|
||||||
|
|
||||||
|
if let value = self as? Double {
|
||||||
|
return CGFloat(value)
|
||||||
|
}
|
||||||
|
|
||||||
|
if let value = self as? Int {
|
||||||
|
return CGFloat(value)
|
||||||
|
}
|
||||||
|
|
||||||
|
if let value = self as? UInt {
|
||||||
|
return CGFloat(value)
|
||||||
|
}
|
||||||
|
|
||||||
|
if let value = self as? CGSize {
|
||||||
|
if layoutAttribute == .width {
|
||||||
|
return value.width
|
||||||
|
} else if layoutAttribute == .height {
|
||||||
|
return value.height
|
||||||
|
} else {
|
||||||
|
return 0.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if let value = self as? CGPoint {
|
||||||
|
#if canImport(UIKit)
|
||||||
|
switch layoutAttribute {
|
||||||
|
case .left, .right, .leading, .trailing, .centerX, .leftMargin, .rightMargin, .leadingMargin, .trailingMargin, .centerXWithinMargins:
|
||||||
|
return value.x
|
||||||
|
case .top, .bottom, .centerY, .topMargin, .bottomMargin, .centerYWithinMargins, .lastBaseline, .firstBaseline:
|
||||||
|
return value.y
|
||||||
|
case .width, .height, .notAnAttribute:
|
||||||
|
return 0.0
|
||||||
|
#if swift(>=5.0)
|
||||||
|
@unknown default:
|
||||||
|
return 0.0
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
switch layoutAttribute {
|
||||||
|
case .left, .right, .leading, .trailing, .centerX:
|
||||||
|
return value.x
|
||||||
|
case .top, .bottom, .centerY, .lastBaseline, .firstBaseline:
|
||||||
|
return value.y
|
||||||
|
case .width, .height, .notAnAttribute:
|
||||||
|
return 0.0
|
||||||
|
#if swift(>=5.0)
|
||||||
|
@unknown default:
|
||||||
|
return 0.0
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
if let value = self as? ConstraintInsets {
|
||||||
|
#if canImport(UIKit)
|
||||||
|
switch layoutAttribute {
|
||||||
|
case .left, .leftMargin:
|
||||||
|
return value.left
|
||||||
|
case .top, .topMargin, .firstBaseline:
|
||||||
|
return value.top
|
||||||
|
case .right, .rightMargin:
|
||||||
|
return -value.right
|
||||||
|
case .bottom, .bottomMargin, .lastBaseline:
|
||||||
|
return -value.bottom
|
||||||
|
case .leading, .leadingMargin:
|
||||||
|
return (ConstraintConfig.interfaceLayoutDirection == .leftToRight) ? value.left : value.right
|
||||||
|
case .trailing, .trailingMargin:
|
||||||
|
return (ConstraintConfig.interfaceLayoutDirection == .leftToRight) ? -value.right : -value.left
|
||||||
|
case .centerX, .centerXWithinMargins:
|
||||||
|
return (value.left - value.right) / 2
|
||||||
|
case .centerY, .centerYWithinMargins:
|
||||||
|
return (value.top - value.bottom) / 2
|
||||||
|
case .width:
|
||||||
|
return -(value.left + value.right)
|
||||||
|
case .height:
|
||||||
|
return -(value.top + value.bottom)
|
||||||
|
case .notAnAttribute:
|
||||||
|
return 0.0
|
||||||
|
#if swift(>=5.0)
|
||||||
|
@unknown default:
|
||||||
|
return 0.0
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
switch layoutAttribute {
|
||||||
|
case .left:
|
||||||
|
return value.left
|
||||||
|
case .top, .firstBaseline:
|
||||||
|
return value.top
|
||||||
|
case .right:
|
||||||
|
return -value.right
|
||||||
|
case .bottom, .lastBaseline:
|
||||||
|
return -value.bottom
|
||||||
|
case .leading:
|
||||||
|
return (ConstraintConfig.interfaceLayoutDirection == .leftToRight) ? value.left : value.right
|
||||||
|
case .trailing:
|
||||||
|
return (ConstraintConfig.interfaceLayoutDirection == .leftToRight) ? -value.right : -value.left
|
||||||
|
case .centerX:
|
||||||
|
return (value.left - value.right) / 2
|
||||||
|
case .centerY:
|
||||||
|
return (value.top - value.bottom) / 2
|
||||||
|
case .width:
|
||||||
|
return -(value.left + value.right)
|
||||||
|
case .height:
|
||||||
|
return -(value.top + value.bottom)
|
||||||
|
case .notAnAttribute:
|
||||||
|
return 0.0
|
||||||
|
#if swift(>=5.0)
|
||||||
|
@unknown default:
|
||||||
|
return 0.0
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#if canImport(UIKit)
|
||||||
|
if #available(iOS 11.0, tvOS 11.0, *), let value = self as? ConstraintDirectionalInsets {
|
||||||
|
switch layoutAttribute {
|
||||||
|
case .left, .leftMargin:
|
||||||
|
return (ConstraintConfig.interfaceLayoutDirection == .leftToRight) ? value.leading : value.trailing
|
||||||
|
case .top, .topMargin, .firstBaseline:
|
||||||
|
return value.top
|
||||||
|
case .right, .rightMargin:
|
||||||
|
return (ConstraintConfig.interfaceLayoutDirection == .leftToRight) ? -value.trailing : -value.leading
|
||||||
|
case .bottom, .bottomMargin, .lastBaseline:
|
||||||
|
return -value.bottom
|
||||||
|
case .leading, .leadingMargin:
|
||||||
|
return value.leading
|
||||||
|
case .trailing, .trailingMargin:
|
||||||
|
return -value.trailing
|
||||||
|
case .centerX, .centerXWithinMargins:
|
||||||
|
return (value.leading - value.trailing) / 2
|
||||||
|
case .centerY, .centerYWithinMargins:
|
||||||
|
return (value.top - value.bottom) / 2
|
||||||
|
case .width:
|
||||||
|
return -(value.leading + value.trailing)
|
||||||
|
case .height:
|
||||||
|
return -(value.top + value.bottom)
|
||||||
|
case .notAnAttribute:
|
||||||
|
return 0.0
|
||||||
|
#if swift(>=5.0)
|
||||||
|
@unknown default:
|
||||||
|
return 0.0
|
||||||
|
#else
|
||||||
|
default:
|
||||||
|
return 0.0
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return 0.0
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+209
@@ -0,0 +1,209 @@
|
|||||||
|
//
|
||||||
|
// SnapKit
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
|
||||||
|
#if canImport(UIKit)
|
||||||
|
import UIKit
|
||||||
|
#else
|
||||||
|
import AppKit
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
public protocol ConstraintDSL {
|
||||||
|
|
||||||
|
var target: AnyObject? { get }
|
||||||
|
|
||||||
|
func setLabel(_ value: String?)
|
||||||
|
func label() -> String?
|
||||||
|
|
||||||
|
}
|
||||||
|
extension ConstraintDSL {
|
||||||
|
|
||||||
|
public func setLabel(_ value: String?) {
|
||||||
|
objc_setAssociatedObject(self.target as Any, &labelKey, value, .OBJC_ASSOCIATION_COPY_NONATOMIC)
|
||||||
|
}
|
||||||
|
public func label() -> String? {
|
||||||
|
return objc_getAssociatedObject(self.target as Any, &labelKey) as? String
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
private var labelKey: UInt8 = 0
|
||||||
|
|
||||||
|
|
||||||
|
public protocol ConstraintBasicAttributesDSL : ConstraintDSL {
|
||||||
|
}
|
||||||
|
extension ConstraintBasicAttributesDSL {
|
||||||
|
|
||||||
|
// MARK: Basics
|
||||||
|
|
||||||
|
public var left: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.target, attributes: ConstraintAttributes.left)
|
||||||
|
}
|
||||||
|
|
||||||
|
public var top: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.target, attributes: ConstraintAttributes.top)
|
||||||
|
}
|
||||||
|
|
||||||
|
public var right: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.target, attributes: ConstraintAttributes.right)
|
||||||
|
}
|
||||||
|
|
||||||
|
public var bottom: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.target, attributes: ConstraintAttributes.bottom)
|
||||||
|
}
|
||||||
|
|
||||||
|
public var leading: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.target, attributes: ConstraintAttributes.leading)
|
||||||
|
}
|
||||||
|
|
||||||
|
public var trailing: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.target, attributes: ConstraintAttributes.trailing)
|
||||||
|
}
|
||||||
|
|
||||||
|
public var width: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.target, attributes: ConstraintAttributes.width)
|
||||||
|
}
|
||||||
|
|
||||||
|
public var height: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.target, attributes: ConstraintAttributes.height)
|
||||||
|
}
|
||||||
|
|
||||||
|
public var centerX: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.target, attributes: ConstraintAttributes.centerX)
|
||||||
|
}
|
||||||
|
|
||||||
|
public var centerY: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.target, attributes: ConstraintAttributes.centerY)
|
||||||
|
}
|
||||||
|
|
||||||
|
public var edges: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.target, attributes: ConstraintAttributes.edges)
|
||||||
|
}
|
||||||
|
|
||||||
|
public var directionalEdges: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.target, attributes: ConstraintAttributes.directionalEdges)
|
||||||
|
}
|
||||||
|
|
||||||
|
public var horizontalEdges: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.target, attributes: ConstraintAttributes.horizontalEdges)
|
||||||
|
}
|
||||||
|
|
||||||
|
public var verticalEdges: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.target, attributes: ConstraintAttributes.verticalEdges)
|
||||||
|
}
|
||||||
|
|
||||||
|
public var directionalHorizontalEdges: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.target, attributes: ConstraintAttributes.directionalHorizontalEdges)
|
||||||
|
}
|
||||||
|
|
||||||
|
public var directionalVerticalEdges: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.target, attributes: ConstraintAttributes.directionalVerticalEdges)
|
||||||
|
}
|
||||||
|
|
||||||
|
public var size: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.target, attributes: ConstraintAttributes.size)
|
||||||
|
}
|
||||||
|
|
||||||
|
public var center: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.target, attributes: ConstraintAttributes.center)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public protocol ConstraintAttributesDSL : ConstraintBasicAttributesDSL {
|
||||||
|
}
|
||||||
|
extension ConstraintAttributesDSL {
|
||||||
|
|
||||||
|
// MARK: Baselines
|
||||||
|
@available(*, deprecated, renamed:"lastBaseline")
|
||||||
|
public var baseline: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.target, attributes: ConstraintAttributes.lastBaseline)
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 8.0, OSX 10.11, *)
|
||||||
|
public var lastBaseline: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.target, attributes: ConstraintAttributes.lastBaseline)
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 8.0, OSX 10.11, *)
|
||||||
|
public var firstBaseline: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.target, attributes: ConstraintAttributes.firstBaseline)
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: Margins
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
public var leftMargin: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.target, attributes: ConstraintAttributes.leftMargin)
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
public var topMargin: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.target, attributes: ConstraintAttributes.topMargin)
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
public var rightMargin: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.target, attributes: ConstraintAttributes.rightMargin)
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
public var bottomMargin: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.target, attributes: ConstraintAttributes.bottomMargin)
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
public var leadingMargin: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.target, attributes: ConstraintAttributes.leadingMargin)
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
public var trailingMargin: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.target, attributes: ConstraintAttributes.trailingMargin)
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
public var centerXWithinMargins: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.target, attributes: ConstraintAttributes.centerXWithinMargins)
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
public var centerYWithinMargins: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.target, attributes: ConstraintAttributes.centerYWithinMargins)
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
public var margins: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.target, attributes: ConstraintAttributes.margins)
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
public var directionalMargins: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.target, attributes: ConstraintAttributes.directionalMargins)
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
public var centerWithinMargins: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.target, attributes: ConstraintAttributes.centerWithinMargins)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
//
|
||||||
|
// SnapKit
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
|
||||||
|
#if canImport(UIKit)
|
||||||
|
import UIKit
|
||||||
|
#else
|
||||||
|
import AppKit
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
public class ConstraintDescription {
|
||||||
|
|
||||||
|
internal let item: LayoutConstraintItem
|
||||||
|
internal var attributes: ConstraintAttributes
|
||||||
|
internal var relation: ConstraintRelation? = nil
|
||||||
|
internal var sourceLocation: (String, UInt)? = nil
|
||||||
|
internal var label: String? = nil
|
||||||
|
internal var related: ConstraintItem? = nil
|
||||||
|
internal var multiplier: ConstraintMultiplierTarget = 1.0
|
||||||
|
internal var constant: ConstraintConstantTarget = 0.0
|
||||||
|
internal var priority: ConstraintPriorityTarget = 1000.0
|
||||||
|
internal lazy var constraint: Constraint? = {
|
||||||
|
guard let relation = self.relation,
|
||||||
|
let related = self.related,
|
||||||
|
let sourceLocation = self.sourceLocation else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
let from = ConstraintItem(target: self.item, attributes: self.attributes)
|
||||||
|
|
||||||
|
return Constraint(
|
||||||
|
from: from,
|
||||||
|
to: related,
|
||||||
|
relation: relation,
|
||||||
|
sourceLocation: sourceLocation,
|
||||||
|
label: self.label,
|
||||||
|
multiplier: self.multiplier,
|
||||||
|
constant: self.constant,
|
||||||
|
priority: self.priority
|
||||||
|
)
|
||||||
|
}()
|
||||||
|
|
||||||
|
// MARK: Initialization
|
||||||
|
|
||||||
|
internal init(item: LayoutConstraintItem, attributes: ConstraintAttributes) {
|
||||||
|
self.item = item
|
||||||
|
self.attributes = attributes
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
//
|
||||||
|
// SnapKit
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
|
||||||
|
#if canImport(UIKit)
|
||||||
|
import UIKit
|
||||||
|
#else
|
||||||
|
import AppKit
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if canImport(UIKit)
|
||||||
|
public protocol ConstraintDirectionalInsetTarget: ConstraintConstantTarget {
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 11.0, tvOS 11.0, *)
|
||||||
|
extension ConstraintDirectionalInsets: ConstraintDirectionalInsetTarget {
|
||||||
|
}
|
||||||
|
|
||||||
|
extension ConstraintDirectionalInsetTarget {
|
||||||
|
|
||||||
|
@available(iOS 11.0, tvOS 11.0, *)
|
||||||
|
internal var constraintDirectionalInsetTargetValue: ConstraintDirectionalInsets {
|
||||||
|
if let amount = self as? ConstraintDirectionalInsets {
|
||||||
|
return amount
|
||||||
|
} else {
|
||||||
|
return ConstraintDirectionalInsets(top: 0, leading: 0, bottom: 0, trailing: 0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
//
|
||||||
|
// SnapKit
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
|
||||||
|
#if canImport(UIKit)
|
||||||
|
import UIKit
|
||||||
|
#else
|
||||||
|
import AppKit
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if canImport(UIKit)
|
||||||
|
@available(iOS 11.0, tvOS 11.0, *)
|
||||||
|
public typealias ConstraintDirectionalInsets = NSDirectionalEdgeInsets
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
//
|
||||||
|
// SnapKit
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
|
||||||
|
#if canImport(UIKit)
|
||||||
|
import UIKit
|
||||||
|
#else
|
||||||
|
import AppKit
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
public protocol ConstraintInsetTarget: ConstraintConstantTarget {
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Int: ConstraintInsetTarget {
|
||||||
|
}
|
||||||
|
|
||||||
|
extension UInt: ConstraintInsetTarget {
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Float: ConstraintInsetTarget {
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Double: ConstraintInsetTarget {
|
||||||
|
}
|
||||||
|
|
||||||
|
extension CGFloat: ConstraintInsetTarget {
|
||||||
|
}
|
||||||
|
|
||||||
|
extension ConstraintInsets: ConstraintInsetTarget {
|
||||||
|
}
|
||||||
|
|
||||||
|
extension ConstraintInsetTarget {
|
||||||
|
|
||||||
|
internal var constraintInsetTargetValue: ConstraintInsets {
|
||||||
|
if let amount = self as? ConstraintInsets {
|
||||||
|
return amount
|
||||||
|
} else if let amount = self as? Float {
|
||||||
|
return ConstraintInsets(top: CGFloat(amount), left: CGFloat(amount), bottom: CGFloat(amount), right: CGFloat(amount))
|
||||||
|
} else if let amount = self as? Double {
|
||||||
|
return ConstraintInsets(top: CGFloat(amount), left: CGFloat(amount), bottom: CGFloat(amount), right: CGFloat(amount))
|
||||||
|
} else if let amount = self as? CGFloat {
|
||||||
|
return ConstraintInsets(top: amount, left: amount, bottom: amount, right: amount)
|
||||||
|
} else if let amount = self as? Int {
|
||||||
|
return ConstraintInsets(top: CGFloat(amount), left: CGFloat(amount), bottom: CGFloat(amount), right: CGFloat(amount))
|
||||||
|
} else if let amount = self as? UInt {
|
||||||
|
return ConstraintInsets(top: CGFloat(amount), left: CGFloat(amount), bottom: CGFloat(amount), right: CGFloat(amount))
|
||||||
|
} else {
|
||||||
|
return ConstraintInsets(top: 0, left: 0, bottom: 0, right: 0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
//
|
||||||
|
// SnapKit
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
|
||||||
|
#if canImport(UIKit)
|
||||||
|
import UIKit
|
||||||
|
#else
|
||||||
|
import AppKit
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if canImport(UIKit)
|
||||||
|
public typealias ConstraintInsets = UIEdgeInsets
|
||||||
|
#else
|
||||||
|
public typealias ConstraintInsets = NSEdgeInsets
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
//
|
||||||
|
// SnapKit
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
|
||||||
|
#if canImport(UIKit)
|
||||||
|
import UIKit
|
||||||
|
#else
|
||||||
|
import AppKit
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
public final class ConstraintItem {
|
||||||
|
|
||||||
|
internal weak var target: AnyObject?
|
||||||
|
internal let attributes: ConstraintAttributes
|
||||||
|
|
||||||
|
internal init(target: AnyObject?, attributes: ConstraintAttributes) {
|
||||||
|
self.target = target
|
||||||
|
self.attributes = attributes
|
||||||
|
}
|
||||||
|
|
||||||
|
internal var layoutConstraintItem: LayoutConstraintItem? {
|
||||||
|
return self.target as? LayoutConstraintItem
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public func ==(lhs: ConstraintItem, rhs: ConstraintItem) -> Bool {
|
||||||
|
// pointer equality
|
||||||
|
guard lhs !== rhs else {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// must both have valid targets and identical attributes
|
||||||
|
guard let target1 = lhs.target,
|
||||||
|
let target2 = rhs.target,
|
||||||
|
target1 === target2 && lhs.attributes == rhs.attributes else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
//
|
||||||
|
// SnapKit
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
|
||||||
|
#if canImport(UIKit)
|
||||||
|
import UIKit
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@available(iOS 9.0, OSX 10.11, *)
|
||||||
|
public extension ConstraintLayoutGuide {
|
||||||
|
|
||||||
|
var snp: ConstraintLayoutGuideDSL {
|
||||||
|
return ConstraintLayoutGuideDSL(guide: self)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
//
|
||||||
|
// SnapKit
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
|
||||||
|
#if canImport(UIKit)
|
||||||
|
import UIKit
|
||||||
|
#else
|
||||||
|
import AppKit
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if canImport(UIKit)
|
||||||
|
@available(iOS 9.0, *)
|
||||||
|
public typealias ConstraintLayoutGuide = UILayoutGuide
|
||||||
|
#else
|
||||||
|
@available(OSX 10.11, *)
|
||||||
|
public typealias ConstraintLayoutGuide = NSLayoutGuide
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
//
|
||||||
|
// SnapKit
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
|
||||||
|
#if canImport(UIKit)
|
||||||
|
import UIKit
|
||||||
|
#else
|
||||||
|
import AppKit
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@available(iOS 9.0, OSX 10.11, *)
|
||||||
|
public struct ConstraintLayoutGuideDSL: ConstraintAttributesDSL {
|
||||||
|
|
||||||
|
@discardableResult
|
||||||
|
public func prepareConstraints(_ closure: (_ make: ConstraintMaker) -> Void) -> [Constraint] {
|
||||||
|
return ConstraintMaker.prepareConstraints(item: self.guide, closure: closure)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func makeConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {
|
||||||
|
ConstraintMaker.makeConstraints(item: self.guide, closure: closure)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func remakeConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {
|
||||||
|
ConstraintMaker.remakeConstraints(item: self.guide, closure: closure)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func updateConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {
|
||||||
|
ConstraintMaker.updateConstraints(item: self.guide, closure: closure)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func removeConstraints() {
|
||||||
|
ConstraintMaker.removeConstraints(item: self.guide)
|
||||||
|
}
|
||||||
|
|
||||||
|
public var target: AnyObject? {
|
||||||
|
return self.guide
|
||||||
|
}
|
||||||
|
|
||||||
|
internal let guide: ConstraintLayoutGuide
|
||||||
|
|
||||||
|
internal init(guide: ConstraintLayoutGuide) {
|
||||||
|
self.guide = guide
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
//
|
||||||
|
// SnapKit
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
|
||||||
|
#if canImport(UIKit)
|
||||||
|
import UIKit
|
||||||
|
#else
|
||||||
|
import AppKit
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if canImport(UIKit)
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
public typealias ConstraintLayoutSupport = UILayoutSupport
|
||||||
|
#else
|
||||||
|
public class ConstraintLayoutSupport {}
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
//
|
||||||
|
// SnapKit
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
|
||||||
|
#if canImport(UIKit)
|
||||||
|
import UIKit
|
||||||
|
#else
|
||||||
|
import AppKit
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
public struct ConstraintLayoutSupportDSL: ConstraintDSL {
|
||||||
|
|
||||||
|
public var target: AnyObject? {
|
||||||
|
return self.support
|
||||||
|
}
|
||||||
|
|
||||||
|
internal let support: ConstraintLayoutSupport
|
||||||
|
|
||||||
|
internal init(support: ConstraintLayoutSupport) {
|
||||||
|
self.support = support
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public var top: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.target, attributes: ConstraintAttributes.top)
|
||||||
|
}
|
||||||
|
|
||||||
|
public var bottom: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.target, attributes: ConstraintAttributes.bottom)
|
||||||
|
}
|
||||||
|
|
||||||
|
public var height: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.target, attributes: ConstraintAttributes.height)
|
||||||
|
}
|
||||||
|
}
|
||||||
+224
@@ -0,0 +1,224 @@
|
|||||||
|
//
|
||||||
|
// SnapKit
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
|
||||||
|
#if canImport(UIKit)
|
||||||
|
import UIKit
|
||||||
|
#else
|
||||||
|
import AppKit
|
||||||
|
#endif
|
||||||
|
|
||||||
|
public class ConstraintMaker {
|
||||||
|
|
||||||
|
public var left: ConstraintMakerExtendable {
|
||||||
|
return self.makeExtendableWithAttributes(.left)
|
||||||
|
}
|
||||||
|
|
||||||
|
public var top: ConstraintMakerExtendable {
|
||||||
|
return self.makeExtendableWithAttributes(.top)
|
||||||
|
}
|
||||||
|
|
||||||
|
public var bottom: ConstraintMakerExtendable {
|
||||||
|
return self.makeExtendableWithAttributes(.bottom)
|
||||||
|
}
|
||||||
|
|
||||||
|
public var right: ConstraintMakerExtendable {
|
||||||
|
return self.makeExtendableWithAttributes(.right)
|
||||||
|
}
|
||||||
|
|
||||||
|
public var leading: ConstraintMakerExtendable {
|
||||||
|
return self.makeExtendableWithAttributes(.leading)
|
||||||
|
}
|
||||||
|
|
||||||
|
public var trailing: ConstraintMakerExtendable {
|
||||||
|
return self.makeExtendableWithAttributes(.trailing)
|
||||||
|
}
|
||||||
|
|
||||||
|
public var width: ConstraintMakerExtendable {
|
||||||
|
return self.makeExtendableWithAttributes(.width)
|
||||||
|
}
|
||||||
|
|
||||||
|
public var height: ConstraintMakerExtendable {
|
||||||
|
return self.makeExtendableWithAttributes(.height)
|
||||||
|
}
|
||||||
|
|
||||||
|
public var centerX: ConstraintMakerExtendable {
|
||||||
|
return self.makeExtendableWithAttributes(.centerX)
|
||||||
|
}
|
||||||
|
|
||||||
|
public var centerY: ConstraintMakerExtendable {
|
||||||
|
return self.makeExtendableWithAttributes(.centerY)
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(*, deprecated, renamed:"lastBaseline")
|
||||||
|
public var baseline: ConstraintMakerExtendable {
|
||||||
|
return self.makeExtendableWithAttributes(.lastBaseline)
|
||||||
|
}
|
||||||
|
|
||||||
|
public var lastBaseline: ConstraintMakerExtendable {
|
||||||
|
return self.makeExtendableWithAttributes(.lastBaseline)
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 8.0, OSX 10.11, *)
|
||||||
|
public var firstBaseline: ConstraintMakerExtendable {
|
||||||
|
return self.makeExtendableWithAttributes(.firstBaseline)
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
public var leftMargin: ConstraintMakerExtendable {
|
||||||
|
return self.makeExtendableWithAttributes(.leftMargin)
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
public var rightMargin: ConstraintMakerExtendable {
|
||||||
|
return self.makeExtendableWithAttributes(.rightMargin)
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
public var topMargin: ConstraintMakerExtendable {
|
||||||
|
return self.makeExtendableWithAttributes(.topMargin)
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
public var bottomMargin: ConstraintMakerExtendable {
|
||||||
|
return self.makeExtendableWithAttributes(.bottomMargin)
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
public var leadingMargin: ConstraintMakerExtendable {
|
||||||
|
return self.makeExtendableWithAttributes(.leadingMargin)
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
public var trailingMargin: ConstraintMakerExtendable {
|
||||||
|
return self.makeExtendableWithAttributes(.trailingMargin)
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
public var centerXWithinMargins: ConstraintMakerExtendable {
|
||||||
|
return self.makeExtendableWithAttributes(.centerXWithinMargins)
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
public var centerYWithinMargins: ConstraintMakerExtendable {
|
||||||
|
return self.makeExtendableWithAttributes(.centerYWithinMargins)
|
||||||
|
}
|
||||||
|
|
||||||
|
public var edges: ConstraintMakerExtendable {
|
||||||
|
return self.makeExtendableWithAttributes(.edges)
|
||||||
|
}
|
||||||
|
public var horizontalEdges: ConstraintMakerExtendable {
|
||||||
|
return self.makeExtendableWithAttributes(.horizontalEdges)
|
||||||
|
}
|
||||||
|
public var verticalEdges: ConstraintMakerExtendable {
|
||||||
|
return self.makeExtendableWithAttributes(.verticalEdges)
|
||||||
|
}
|
||||||
|
public var directionalEdges: ConstraintMakerExtendable {
|
||||||
|
return self.makeExtendableWithAttributes(.directionalEdges)
|
||||||
|
}
|
||||||
|
public var directionalHorizontalEdges: ConstraintMakerExtendable {
|
||||||
|
return self.makeExtendableWithAttributes(.directionalHorizontalEdges)
|
||||||
|
}
|
||||||
|
public var directionalVerticalEdges: ConstraintMakerExtendable {
|
||||||
|
return self.makeExtendableWithAttributes(.directionalVerticalEdges)
|
||||||
|
}
|
||||||
|
public var size: ConstraintMakerExtendable {
|
||||||
|
return self.makeExtendableWithAttributes(.size)
|
||||||
|
}
|
||||||
|
public var center: ConstraintMakerExtendable {
|
||||||
|
return self.makeExtendableWithAttributes(.center)
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
public var margins: ConstraintMakerExtendable {
|
||||||
|
return self.makeExtendableWithAttributes(.margins)
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
public var directionalMargins: ConstraintMakerExtendable {
|
||||||
|
return self.makeExtendableWithAttributes(.directionalMargins)
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
public var centerWithinMargins: ConstraintMakerExtendable {
|
||||||
|
return self.makeExtendableWithAttributes(.centerWithinMargins)
|
||||||
|
}
|
||||||
|
|
||||||
|
public let item: LayoutConstraintItem
|
||||||
|
private var descriptions = [ConstraintDescription]()
|
||||||
|
|
||||||
|
internal init(item: LayoutConstraintItem) {
|
||||||
|
self.item = item
|
||||||
|
self.item.prepare()
|
||||||
|
}
|
||||||
|
|
||||||
|
internal func makeExtendableWithAttributes(_ attributes: ConstraintAttributes) -> ConstraintMakerExtendable {
|
||||||
|
let description = ConstraintDescription(item: self.item, attributes: attributes)
|
||||||
|
self.descriptions.append(description)
|
||||||
|
return ConstraintMakerExtendable(description)
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static func prepareConstraints(item: LayoutConstraintItem, closure: (_ make: ConstraintMaker) -> Void) -> [Constraint] {
|
||||||
|
let maker = ConstraintMaker(item: item)
|
||||||
|
closure(maker)
|
||||||
|
var constraints: [Constraint] = []
|
||||||
|
for description in maker.descriptions {
|
||||||
|
guard let constraint = description.constraint else {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
constraints.append(constraint)
|
||||||
|
}
|
||||||
|
return constraints
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static func makeConstraints(item: LayoutConstraintItem, closure: (_ make: ConstraintMaker) -> Void) {
|
||||||
|
let constraints = prepareConstraints(item: item, closure: closure)
|
||||||
|
for constraint in constraints {
|
||||||
|
constraint.activateIfNeeded(updatingExisting: false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static func remakeConstraints(item: LayoutConstraintItem, closure: (_ make: ConstraintMaker) -> Void) {
|
||||||
|
self.removeConstraints(item: item)
|
||||||
|
self.makeConstraints(item: item, closure: closure)
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static func updateConstraints(item: LayoutConstraintItem, closure: (_ make: ConstraintMaker) -> Void) {
|
||||||
|
guard item.constraints.count > 0 else {
|
||||||
|
self.makeConstraints(item: item, closure: closure)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
let constraints = prepareConstraints(item: item, closure: closure)
|
||||||
|
for constraint in constraints {
|
||||||
|
constraint.activateIfNeeded(updatingExisting: true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static func removeConstraints(item: LayoutConstraintItem) {
|
||||||
|
let constraints = item.constraints
|
||||||
|
for constraint in constraints {
|
||||||
|
constraint.deactivateIfNeeded()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
//
|
||||||
|
// SnapKit
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
|
||||||
|
#if canImport(UIKit)
|
||||||
|
import UIKit
|
||||||
|
#else
|
||||||
|
import AppKit
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
public class ConstraintMakerEditable: ConstraintMakerPrioritizable {
|
||||||
|
|
||||||
|
@discardableResult
|
||||||
|
public func multipliedBy(_ amount: ConstraintMultiplierTarget) -> ConstraintMakerEditable {
|
||||||
|
self.description.multiplier = amount
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
@discardableResult
|
||||||
|
public func dividedBy(_ amount: ConstraintMultiplierTarget) -> ConstraintMakerEditable {
|
||||||
|
return self.multipliedBy(1.0 / amount.constraintMultiplierTargetValue)
|
||||||
|
}
|
||||||
|
|
||||||
|
@discardableResult
|
||||||
|
public func offset(_ amount: ConstraintOffsetTarget) -> ConstraintMakerEditable {
|
||||||
|
self.description.constant = amount.constraintOffsetTargetValue
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
@discardableResult
|
||||||
|
public func inset(_ amount: ConstraintInsetTarget) -> ConstraintMakerEditable {
|
||||||
|
self.description.constant = amount.constraintInsetTargetValue
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
#if canImport(UIKit)
|
||||||
|
@discardableResult
|
||||||
|
@available(iOS 11.0, tvOS 11.0, *)
|
||||||
|
public func inset(_ amount: ConstraintDirectionalInsetTarget) -> ConstraintMakerEditable {
|
||||||
|
self.description.constant = amount.constraintDirectionalInsetTargetValue
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
@@ -0,0 +1,195 @@
|
|||||||
|
//
|
||||||
|
// SnapKit
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
|
||||||
|
#if canImport(UIKit)
|
||||||
|
import UIKit
|
||||||
|
#else
|
||||||
|
import AppKit
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
public class ConstraintMakerExtendable: ConstraintMakerRelatable {
|
||||||
|
|
||||||
|
public var left: ConstraintMakerExtendable {
|
||||||
|
self.description.attributes += .left
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
public var top: ConstraintMakerExtendable {
|
||||||
|
self.description.attributes += .top
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
public var bottom: ConstraintMakerExtendable {
|
||||||
|
self.description.attributes += .bottom
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
public var right: ConstraintMakerExtendable {
|
||||||
|
self.description.attributes += .right
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
public var leading: ConstraintMakerExtendable {
|
||||||
|
self.description.attributes += .leading
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
public var trailing: ConstraintMakerExtendable {
|
||||||
|
self.description.attributes += .trailing
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
public var width: ConstraintMakerExtendable {
|
||||||
|
self.description.attributes += .width
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
public var height: ConstraintMakerExtendable {
|
||||||
|
self.description.attributes += .height
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
public var centerX: ConstraintMakerExtendable {
|
||||||
|
self.description.attributes += .centerX
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
public var centerY: ConstraintMakerExtendable {
|
||||||
|
self.description.attributes += .centerY
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(*, deprecated, renamed:"lastBaseline")
|
||||||
|
public var baseline: ConstraintMakerExtendable {
|
||||||
|
self.description.attributes += .lastBaseline
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
public var lastBaseline: ConstraintMakerExtendable {
|
||||||
|
self.description.attributes += .lastBaseline
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 8.0, OSX 10.11, *)
|
||||||
|
public var firstBaseline: ConstraintMakerExtendable {
|
||||||
|
self.description.attributes += .firstBaseline
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
public var leftMargin: ConstraintMakerExtendable {
|
||||||
|
self.description.attributes += .leftMargin
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
public var rightMargin: ConstraintMakerExtendable {
|
||||||
|
self.description.attributes += .rightMargin
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
public var topMargin: ConstraintMakerExtendable {
|
||||||
|
self.description.attributes += .topMargin
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
public var bottomMargin: ConstraintMakerExtendable {
|
||||||
|
self.description.attributes += .bottomMargin
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
public var leadingMargin: ConstraintMakerExtendable {
|
||||||
|
self.description.attributes += .leadingMargin
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
public var trailingMargin: ConstraintMakerExtendable {
|
||||||
|
self.description.attributes += .trailingMargin
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
public var centerXWithinMargins: ConstraintMakerExtendable {
|
||||||
|
self.description.attributes += .centerXWithinMargins
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
public var centerYWithinMargins: ConstraintMakerExtendable {
|
||||||
|
self.description.attributes += .centerYWithinMargins
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
public var edges: ConstraintMakerExtendable {
|
||||||
|
self.description.attributes += .edges
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
public var horizontalEdges: ConstraintMakerExtendable {
|
||||||
|
self.description.attributes += .horizontalEdges
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
public var verticalEdges: ConstraintMakerExtendable {
|
||||||
|
self.description.attributes += .verticalEdges
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
public var directionalEdges: ConstraintMakerExtendable {
|
||||||
|
self.description.attributes += .directionalEdges
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
public var directionalHorizontalEdges: ConstraintMakerExtendable {
|
||||||
|
self.description.attributes += .directionalHorizontalEdges
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
public var directionalVerticalEdges: ConstraintMakerExtendable {
|
||||||
|
self.description.attributes += .directionalVerticalEdges
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
public var size: ConstraintMakerExtendable {
|
||||||
|
self.description.attributes += .size
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
public var margins: ConstraintMakerExtendable {
|
||||||
|
self.description.attributes += .margins
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
public var directionalMargins: ConstraintMakerExtendable {
|
||||||
|
self.description.attributes += .directionalMargins
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
public var centerWithinMargins: ConstraintMakerExtendable {
|
||||||
|
self.description.attributes += .centerWithinMargins
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
//
|
||||||
|
// SnapKit
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
|
||||||
|
#if canImport(UIKit)
|
||||||
|
import UIKit
|
||||||
|
#else
|
||||||
|
import AppKit
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
public class ConstraintMakerFinalizable {
|
||||||
|
|
||||||
|
internal let description: ConstraintDescription
|
||||||
|
|
||||||
|
internal init(_ description: ConstraintDescription) {
|
||||||
|
self.description = description
|
||||||
|
}
|
||||||
|
|
||||||
|
@discardableResult
|
||||||
|
public func labeled(_ label: String) -> ConstraintMakerFinalizable {
|
||||||
|
self.description.label = label
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
public var constraint: Constraint {
|
||||||
|
return self.description.constraint!
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
//
|
||||||
|
// SnapKit
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
|
||||||
|
#if canImport(UIKit)
|
||||||
|
import UIKit
|
||||||
|
#else
|
||||||
|
import AppKit
|
||||||
|
#endif
|
||||||
|
|
||||||
|
@available(*, deprecated, message:"Use ConstraintMakerPrioritizable instead.")
|
||||||
|
public typealias ConstraintMakerPriortizable = ConstraintMakerPrioritizable
|
||||||
|
|
||||||
|
public class ConstraintMakerPrioritizable: ConstraintMakerFinalizable {
|
||||||
|
|
||||||
|
@discardableResult
|
||||||
|
public func priority(_ amount: ConstraintPriority) -> ConstraintMakerFinalizable {
|
||||||
|
self.description.priority = amount.value
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
@discardableResult
|
||||||
|
public func priority(_ amount: ConstraintPriorityTarget) -> ConstraintMakerFinalizable {
|
||||||
|
self.description.priority = amount
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(*, deprecated, message:"Use priority(.required) instead.")
|
||||||
|
@discardableResult
|
||||||
|
public func priorityRequired() -> ConstraintMakerFinalizable {
|
||||||
|
return self.priority(.required)
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(*, deprecated, message:"Use priority(.high) instead.")
|
||||||
|
@discardableResult
|
||||||
|
public func priorityHigh() -> ConstraintMakerFinalizable {
|
||||||
|
return self.priority(.high)
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(*, deprecated, message:"Use priority(.medium) instead.")
|
||||||
|
@discardableResult
|
||||||
|
public func priorityMedium() -> ConstraintMakerFinalizable {
|
||||||
|
return self.priority(.medium)
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(*, deprecated, message:"Use priority(.low) instead.")
|
||||||
|
@discardableResult
|
||||||
|
public func priorityLow() -> ConstraintMakerFinalizable {
|
||||||
|
return self.priority(.low)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
//
|
||||||
|
// SnapKit
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
|
||||||
|
#if canImport(UIKit)
|
||||||
|
import UIKit
|
||||||
|
#else
|
||||||
|
import AppKit
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
extension ConstraintMakerRelatable {
|
||||||
|
|
||||||
|
@discardableResult
|
||||||
|
public func equalToSuperview<T: ConstraintRelatableTarget>(_ closure: (ConstraintView) -> T, _ file: String = #file, line: UInt = #line) -> ConstraintMakerEditable {
|
||||||
|
guard let other = self.description.item.superview else {
|
||||||
|
fatalError("Expected superview but found nil when attempting make constraint `equalToSuperview`.")
|
||||||
|
}
|
||||||
|
return self.relatedTo(closure(other), relation: .equal, file: file, line: line)
|
||||||
|
}
|
||||||
|
|
||||||
|
@discardableResult
|
||||||
|
public func lessThanOrEqualToSuperview<T: ConstraintRelatableTarget>(_ closure: (ConstraintView) -> T, _ file: String = #file, line: UInt = #line) -> ConstraintMakerEditable {
|
||||||
|
guard let other = self.description.item.superview else {
|
||||||
|
fatalError("Expected superview but found nil when attempting make constraint `lessThanOrEqualToSuperview`.")
|
||||||
|
}
|
||||||
|
return self.relatedTo(closure(other), relation: .lessThanOrEqual, file: file, line: line)
|
||||||
|
}
|
||||||
|
|
||||||
|
@discardableResult
|
||||||
|
public func greaterThanOrEqualToSuperview<T: ConstraintRelatableTarget>(_ closure: (ConstraintView) -> T, _ file: String = #file, line: UInt = #line) -> ConstraintMakerEditable {
|
||||||
|
guard let other = self.description.item.superview else {
|
||||||
|
fatalError("Expected superview but found nil when attempting make constraint `greaterThanOrEqualToSuperview`.")
|
||||||
|
}
|
||||||
|
return self.relatedTo(closure(other), relation: .greaterThanOrEqual, file: file, line: line)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,115 @@
|
|||||||
|
//
|
||||||
|
// SnapKit
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
|
||||||
|
#if canImport(UIKit)
|
||||||
|
import UIKit
|
||||||
|
#else
|
||||||
|
import AppKit
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
public class ConstraintMakerRelatable {
|
||||||
|
|
||||||
|
internal let description: ConstraintDescription
|
||||||
|
|
||||||
|
internal init(_ description: ConstraintDescription) {
|
||||||
|
self.description = description
|
||||||
|
}
|
||||||
|
|
||||||
|
internal func relatedTo(_ other: ConstraintRelatableTarget, relation: ConstraintRelation, file: String, line: UInt) -> ConstraintMakerEditable {
|
||||||
|
let related: ConstraintItem
|
||||||
|
let constant: ConstraintConstantTarget
|
||||||
|
|
||||||
|
if let other = other as? ConstraintItem {
|
||||||
|
guard other.attributes == ConstraintAttributes.none ||
|
||||||
|
other.attributes.layoutAttributes.count <= 1 ||
|
||||||
|
other.attributes.layoutAttributes == self.description.attributes.layoutAttributes ||
|
||||||
|
other.attributes == .edges && self.description.attributes == .margins ||
|
||||||
|
other.attributes == .margins && self.description.attributes == .edges ||
|
||||||
|
other.attributes == .directionalEdges && self.description.attributes == .directionalMargins ||
|
||||||
|
other.attributes == .directionalMargins && self.description.attributes == .directionalEdges else {
|
||||||
|
fatalError("Cannot constraint to multiple non identical attributes. (\(file), \(line))");
|
||||||
|
}
|
||||||
|
|
||||||
|
related = other
|
||||||
|
constant = 0.0
|
||||||
|
} else if let other = other as? ConstraintView {
|
||||||
|
related = ConstraintItem(target: other, attributes: ConstraintAttributes.none)
|
||||||
|
constant = 0.0
|
||||||
|
} else if let other = other as? ConstraintConstantTarget {
|
||||||
|
related = ConstraintItem(target: nil, attributes: ConstraintAttributes.none)
|
||||||
|
constant = other
|
||||||
|
} else if #available(iOS 9.0, OSX 10.11, *), let other = other as? ConstraintLayoutGuide {
|
||||||
|
related = ConstraintItem(target: other, attributes: ConstraintAttributes.none)
|
||||||
|
constant = 0.0
|
||||||
|
} else {
|
||||||
|
fatalError("Invalid constraint. (\(file), \(line))")
|
||||||
|
}
|
||||||
|
|
||||||
|
let editable = ConstraintMakerEditable(self.description)
|
||||||
|
editable.description.sourceLocation = (file, line)
|
||||||
|
editable.description.relation = relation
|
||||||
|
editable.description.related = related
|
||||||
|
editable.description.constant = constant
|
||||||
|
return editable
|
||||||
|
}
|
||||||
|
|
||||||
|
@discardableResult
|
||||||
|
public func equalTo(_ other: ConstraintRelatableTarget, _ file: String = #file, _ line: UInt = #line) -> ConstraintMakerEditable {
|
||||||
|
return self.relatedTo(other, relation: .equal, file: file, line: line)
|
||||||
|
}
|
||||||
|
|
||||||
|
@discardableResult
|
||||||
|
public func equalToSuperview(_ file: String = #file, _ line: UInt = #line) -> ConstraintMakerEditable {
|
||||||
|
guard let other = self.description.item.superview else {
|
||||||
|
fatalError("Expected superview but found nil when attempting make constraint `equalToSuperview`.")
|
||||||
|
}
|
||||||
|
return self.relatedTo(other, relation: .equal, file: file, line: line)
|
||||||
|
}
|
||||||
|
|
||||||
|
@discardableResult
|
||||||
|
public func lessThanOrEqualTo(_ other: ConstraintRelatableTarget, _ file: String = #file, _ line: UInt = #line) -> ConstraintMakerEditable {
|
||||||
|
return self.relatedTo(other, relation: .lessThanOrEqual, file: file, line: line)
|
||||||
|
}
|
||||||
|
|
||||||
|
@discardableResult
|
||||||
|
public func lessThanOrEqualToSuperview(_ file: String = #file, _ line: UInt = #line) -> ConstraintMakerEditable {
|
||||||
|
guard let other = self.description.item.superview else {
|
||||||
|
fatalError("Expected superview but found nil when attempting make constraint `lessThanOrEqualToSuperview`.")
|
||||||
|
}
|
||||||
|
return self.relatedTo(other, relation: .lessThanOrEqual, file: file, line: line)
|
||||||
|
}
|
||||||
|
|
||||||
|
@discardableResult
|
||||||
|
public func greaterThanOrEqualTo(_ other: ConstraintRelatableTarget, _ file: String = #file, line: UInt = #line) -> ConstraintMakerEditable {
|
||||||
|
return self.relatedTo(other, relation: .greaterThanOrEqual, file: file, line: line)
|
||||||
|
}
|
||||||
|
|
||||||
|
@discardableResult
|
||||||
|
public func greaterThanOrEqualToSuperview(_ file: String = #file, line: UInt = #line) -> ConstraintMakerEditable {
|
||||||
|
guard let other = self.description.item.superview else {
|
||||||
|
fatalError("Expected superview but found nil when attempting make constraint `greaterThanOrEqualToSuperview`.")
|
||||||
|
}
|
||||||
|
return self.relatedTo(other, relation: .greaterThanOrEqual, file: file, line: line)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
//
|
||||||
|
// SnapKit
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
|
||||||
|
#if canImport(UIKit)
|
||||||
|
import UIKit
|
||||||
|
#else
|
||||||
|
import AppKit
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
public protocol ConstraintMultiplierTarget {
|
||||||
|
|
||||||
|
var constraintMultiplierTargetValue: CGFloat { get }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Int: ConstraintMultiplierTarget {
|
||||||
|
|
||||||
|
public var constraintMultiplierTargetValue: CGFloat {
|
||||||
|
return CGFloat(self)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
extension UInt: ConstraintMultiplierTarget {
|
||||||
|
|
||||||
|
public var constraintMultiplierTargetValue: CGFloat {
|
||||||
|
return CGFloat(self)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Float: ConstraintMultiplierTarget {
|
||||||
|
|
||||||
|
public var constraintMultiplierTargetValue: CGFloat {
|
||||||
|
return CGFloat(self)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Double: ConstraintMultiplierTarget {
|
||||||
|
|
||||||
|
public var constraintMultiplierTargetValue: CGFloat {
|
||||||
|
return CGFloat(self)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
extension CGFloat: ConstraintMultiplierTarget {
|
||||||
|
|
||||||
|
public var constraintMultiplierTargetValue: CGFloat {
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
//
|
||||||
|
// SnapKit
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
|
||||||
|
#if canImport(UIKit)
|
||||||
|
import UIKit
|
||||||
|
#else
|
||||||
|
import AppKit
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
public protocol ConstraintOffsetTarget: ConstraintConstantTarget {
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Int: ConstraintOffsetTarget {
|
||||||
|
}
|
||||||
|
|
||||||
|
extension UInt: ConstraintOffsetTarget {
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Float: ConstraintOffsetTarget {
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Double: ConstraintOffsetTarget {
|
||||||
|
}
|
||||||
|
|
||||||
|
extension CGFloat: ConstraintOffsetTarget {
|
||||||
|
}
|
||||||
|
|
||||||
|
extension ConstraintOffsetTarget {
|
||||||
|
|
||||||
|
internal var constraintOffsetTargetValue: CGFloat {
|
||||||
|
let offset: CGFloat
|
||||||
|
if let amount = self as? Float {
|
||||||
|
offset = CGFloat(amount)
|
||||||
|
} else if let amount = self as? Double {
|
||||||
|
offset = CGFloat(amount)
|
||||||
|
} else if let amount = self as? CGFloat {
|
||||||
|
offset = CGFloat(amount)
|
||||||
|
} else if let amount = self as? Int {
|
||||||
|
offset = CGFloat(amount)
|
||||||
|
} else if let amount = self as? UInt {
|
||||||
|
offset = CGFloat(amount)
|
||||||
|
} else {
|
||||||
|
offset = 0.0
|
||||||
|
}
|
||||||
|
return offset
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
//
|
||||||
|
// SnapKit
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
|
||||||
|
#if canImport(UIKit)
|
||||||
|
import UIKit
|
||||||
|
#else
|
||||||
|
import AppKit
|
||||||
|
#endif
|
||||||
|
|
||||||
|
public struct ConstraintPriority : ExpressibleByFloatLiteral, Equatable, Strideable {
|
||||||
|
public typealias FloatLiteralType = Float
|
||||||
|
|
||||||
|
public let value: Float
|
||||||
|
|
||||||
|
public init(floatLiteral value: Float) {
|
||||||
|
self.value = value
|
||||||
|
}
|
||||||
|
|
||||||
|
public init(_ value: Float) {
|
||||||
|
self.value = value
|
||||||
|
}
|
||||||
|
|
||||||
|
public static var required: ConstraintPriority {
|
||||||
|
return 1000.0
|
||||||
|
}
|
||||||
|
|
||||||
|
public static var high: ConstraintPriority {
|
||||||
|
return 750.0
|
||||||
|
}
|
||||||
|
|
||||||
|
public static var medium: ConstraintPriority {
|
||||||
|
#if os(OSX)
|
||||||
|
return 501.0
|
||||||
|
#else
|
||||||
|
return 500.0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static var low: ConstraintPriority {
|
||||||
|
return 250.0
|
||||||
|
}
|
||||||
|
|
||||||
|
public static func ==(lhs: ConstraintPriority, rhs: ConstraintPriority) -> Bool {
|
||||||
|
return lhs.value == rhs.value
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: Strideable
|
||||||
|
|
||||||
|
public func advanced(by n: FloatLiteralType) -> ConstraintPriority {
|
||||||
|
return ConstraintPriority(floatLiteral: value + n)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func distance(to other: ConstraintPriority) -> FloatLiteralType {
|
||||||
|
return other.value - value
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,85 @@
|
|||||||
|
//
|
||||||
|
// SnapKit
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
|
||||||
|
#if canImport(UIKit)
|
||||||
|
import UIKit
|
||||||
|
#else
|
||||||
|
import AppKit
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
public protocol ConstraintPriorityTarget {
|
||||||
|
|
||||||
|
var constraintPriorityTargetValue: Float { get }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Int: ConstraintPriorityTarget {
|
||||||
|
|
||||||
|
public var constraintPriorityTargetValue: Float {
|
||||||
|
return Float(self)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
extension UInt: ConstraintPriorityTarget {
|
||||||
|
|
||||||
|
public var constraintPriorityTargetValue: Float {
|
||||||
|
return Float(self)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Float: ConstraintPriorityTarget {
|
||||||
|
|
||||||
|
public var constraintPriorityTargetValue: Float {
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Double: ConstraintPriorityTarget {
|
||||||
|
|
||||||
|
public var constraintPriorityTargetValue: Float {
|
||||||
|
return Float(self)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
extension CGFloat: ConstraintPriorityTarget {
|
||||||
|
|
||||||
|
public var constraintPriorityTargetValue: Float {
|
||||||
|
return Float(self)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#if canImport(UIKit)
|
||||||
|
extension UILayoutPriority: ConstraintPriorityTarget {
|
||||||
|
|
||||||
|
public var constraintPriorityTargetValue: Float {
|
||||||
|
return self.rawValue
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
//
|
||||||
|
// SnapKit
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
|
||||||
|
#if canImport(UIKit)
|
||||||
|
import UIKit
|
||||||
|
#else
|
||||||
|
import AppKit
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
public protocol ConstraintRelatableTarget {
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Int: ConstraintRelatableTarget {
|
||||||
|
}
|
||||||
|
|
||||||
|
extension UInt: ConstraintRelatableTarget {
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Float: ConstraintRelatableTarget {
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Double: ConstraintRelatableTarget {
|
||||||
|
}
|
||||||
|
|
||||||
|
extension CGFloat: ConstraintRelatableTarget {
|
||||||
|
}
|
||||||
|
|
||||||
|
extension CGSize: ConstraintRelatableTarget {
|
||||||
|
}
|
||||||
|
|
||||||
|
extension CGPoint: ConstraintRelatableTarget {
|
||||||
|
}
|
||||||
|
|
||||||
|
extension ConstraintInsets: ConstraintRelatableTarget {
|
||||||
|
}
|
||||||
|
|
||||||
|
#if canImport(UIKit)
|
||||||
|
@available(iOS 11.0, tvOS 11.0, *)
|
||||||
|
extension ConstraintDirectionalInsets: ConstraintRelatableTarget {
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extension ConstraintItem: ConstraintRelatableTarget {
|
||||||
|
}
|
||||||
|
|
||||||
|
extension ConstraintView: ConstraintRelatableTarget {
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 9.0, OSX 10.11, *)
|
||||||
|
extension ConstraintLayoutGuide: ConstraintRelatableTarget {
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
//
|
||||||
|
// SnapKit
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
|
||||||
|
#if canImport(UIKit)
|
||||||
|
import UIKit
|
||||||
|
#else
|
||||||
|
import AppKit
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
internal enum ConstraintRelation : Int {
|
||||||
|
case equal = 1
|
||||||
|
case lessThanOrEqual
|
||||||
|
case greaterThanOrEqual
|
||||||
|
|
||||||
|
internal var layoutRelation: LayoutRelation {
|
||||||
|
get {
|
||||||
|
switch(self) {
|
||||||
|
case .equal:
|
||||||
|
return .equal
|
||||||
|
case .lessThanOrEqual:
|
||||||
|
return .lessThanOrEqual
|
||||||
|
case .greaterThanOrEqual:
|
||||||
|
return .greaterThanOrEqual
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,152 @@
|
|||||||
|
//
|
||||||
|
// SnapKit
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
|
||||||
|
#if canImport(UIKit)
|
||||||
|
import UIKit
|
||||||
|
#else
|
||||||
|
import AppKit
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
public extension ConstraintView {
|
||||||
|
|
||||||
|
@available(*, deprecated, renamed:"snp.left")
|
||||||
|
var snp_left: ConstraintItem { return self.snp.left }
|
||||||
|
|
||||||
|
@available(*, deprecated, renamed:"snp.top")
|
||||||
|
var snp_top: ConstraintItem { return self.snp.top }
|
||||||
|
|
||||||
|
@available(*, deprecated, renamed:"snp.right")
|
||||||
|
var snp_right: ConstraintItem { return self.snp.right }
|
||||||
|
|
||||||
|
@available(*, deprecated, renamed:"snp.bottom")
|
||||||
|
var snp_bottom: ConstraintItem { return self.snp.bottom }
|
||||||
|
|
||||||
|
@available(*, deprecated, renamed:"snp.leading")
|
||||||
|
var snp_leading: ConstraintItem { return self.snp.leading }
|
||||||
|
|
||||||
|
@available(*, deprecated, renamed:"snp.trailing")
|
||||||
|
var snp_trailing: ConstraintItem { return self.snp.trailing }
|
||||||
|
|
||||||
|
@available(*, deprecated, renamed:"snp.width")
|
||||||
|
var snp_width: ConstraintItem { return self.snp.width }
|
||||||
|
|
||||||
|
@available(*, deprecated, renamed:"snp.height")
|
||||||
|
var snp_height: ConstraintItem { return self.snp.height }
|
||||||
|
|
||||||
|
@available(*, deprecated, renamed:"snp.centerX")
|
||||||
|
var snp_centerX: ConstraintItem { return self.snp.centerX }
|
||||||
|
|
||||||
|
@available(*, deprecated, renamed:"snp.centerY")
|
||||||
|
var snp_centerY: ConstraintItem { return self.snp.centerY }
|
||||||
|
|
||||||
|
@available(*, deprecated, renamed:"snp.baseline")
|
||||||
|
var snp_baseline: ConstraintItem { return self.snp.baseline }
|
||||||
|
|
||||||
|
@available(*, deprecated, renamed:"snp.lastBaseline")
|
||||||
|
@available(iOS 8.0, OSX 10.11, *)
|
||||||
|
var snp_lastBaseline: ConstraintItem { return self.snp.lastBaseline }
|
||||||
|
|
||||||
|
@available(iOS, deprecated, renamed:"snp.firstBaseline")
|
||||||
|
@available(iOS 8.0, OSX 10.11, *)
|
||||||
|
var snp_firstBaseline: ConstraintItem { return self.snp.firstBaseline }
|
||||||
|
|
||||||
|
@available(iOS, deprecated, renamed:"snp.leftMargin")
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
var snp_leftMargin: ConstraintItem { return self.snp.leftMargin }
|
||||||
|
|
||||||
|
@available(iOS, deprecated, renamed:"snp.topMargin")
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
var snp_topMargin: ConstraintItem { return self.snp.topMargin }
|
||||||
|
|
||||||
|
@available(iOS, deprecated, renamed:"snp.rightMargin")
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
var snp_rightMargin: ConstraintItem { return self.snp.rightMargin }
|
||||||
|
|
||||||
|
@available(iOS, deprecated, renamed:"snp.bottomMargin")
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
var snp_bottomMargin: ConstraintItem { return self.snp.bottomMargin }
|
||||||
|
|
||||||
|
@available(iOS, deprecated, renamed:"snp.leadingMargin")
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
var snp_leadingMargin: ConstraintItem { return self.snp.leadingMargin }
|
||||||
|
|
||||||
|
@available(iOS, deprecated, renamed:"snp.trailingMargin")
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
var snp_trailingMargin: ConstraintItem { return self.snp.trailingMargin }
|
||||||
|
|
||||||
|
@available(iOS, deprecated, renamed:"snp.centerXWithinMargins")
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
var snp_centerXWithinMargins: ConstraintItem { return self.snp.centerXWithinMargins }
|
||||||
|
|
||||||
|
@available(iOS, deprecated, renamed:"snp.centerYWithinMargins")
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
var snp_centerYWithinMargins: ConstraintItem { return self.snp.centerYWithinMargins }
|
||||||
|
|
||||||
|
@available(*, deprecated, renamed:"snp.edges")
|
||||||
|
var snp_edges: ConstraintItem { return self.snp.edges }
|
||||||
|
|
||||||
|
@available(*, deprecated, renamed:"snp.size")
|
||||||
|
var snp_size: ConstraintItem { return self.snp.size }
|
||||||
|
|
||||||
|
@available(*, deprecated, renamed:"snp.center")
|
||||||
|
var snp_center: ConstraintItem { return self.snp.center }
|
||||||
|
|
||||||
|
@available(iOS, deprecated, renamed:"snp.margins")
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
var snp_margins: ConstraintItem { return self.snp.margins }
|
||||||
|
|
||||||
|
@available(iOS, deprecated, renamed:"snp.centerWithinMargins")
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
var snp_centerWithinMargins: ConstraintItem { return self.snp.centerWithinMargins }
|
||||||
|
|
||||||
|
@available(*, deprecated, renamed:"snp.prepareConstraints(_:)")
|
||||||
|
func snp_prepareConstraints(_ closure: (_ make: ConstraintMaker) -> Void) -> [Constraint] {
|
||||||
|
return self.snp.prepareConstraints(closure)
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(*, deprecated, renamed:"snp.makeConstraints(_:)")
|
||||||
|
func snp_makeConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {
|
||||||
|
self.snp.makeConstraints(closure)
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(*, deprecated, renamed:"snp.remakeConstraints(_:)")
|
||||||
|
func snp_remakeConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {
|
||||||
|
self.snp.remakeConstraints(closure)
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(*, deprecated, renamed:"snp.updateConstraints(_:)")
|
||||||
|
func snp_updateConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {
|
||||||
|
self.snp.updateConstraints(closure)
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(*, deprecated, renamed:"snp.removeConstraints()")
|
||||||
|
func snp_removeConstraints() {
|
||||||
|
self.snp.removeConstraints()
|
||||||
|
}
|
||||||
|
|
||||||
|
var snp: ConstraintViewDSL {
|
||||||
|
return ConstraintViewDSL(view: self)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
//
|
||||||
|
// SnapKit
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
|
||||||
|
#if canImport(UIKit)
|
||||||
|
import UIKit
|
||||||
|
#else
|
||||||
|
import AppKit
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if canImport(UIKit)
|
||||||
|
public typealias ConstraintView = UIView
|
||||||
|
#else
|
||||||
|
public typealias ConstraintView = NSView
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,101 @@
|
|||||||
|
//
|
||||||
|
// SnapKit
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
|
||||||
|
#if canImport(UIKit)
|
||||||
|
import UIKit
|
||||||
|
#else
|
||||||
|
import AppKit
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
public struct ConstraintViewDSL: ConstraintAttributesDSL {
|
||||||
|
|
||||||
|
@discardableResult
|
||||||
|
public func prepareConstraints(_ closure: (_ make: ConstraintMaker) -> Void) -> [Constraint] {
|
||||||
|
return ConstraintMaker.prepareConstraints(item: self.view, closure: closure)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func makeConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {
|
||||||
|
ConstraintMaker.makeConstraints(item: self.view, closure: closure)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func remakeConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {
|
||||||
|
ConstraintMaker.remakeConstraints(item: self.view, closure: closure)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func updateConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {
|
||||||
|
ConstraintMaker.updateConstraints(item: self.view, closure: closure)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func removeConstraints() {
|
||||||
|
ConstraintMaker.removeConstraints(item: self.view)
|
||||||
|
}
|
||||||
|
|
||||||
|
public var contentHuggingHorizontalPriority: Float {
|
||||||
|
get {
|
||||||
|
return self.view.contentHuggingPriority(for: .horizontal).rawValue
|
||||||
|
}
|
||||||
|
nonmutating set {
|
||||||
|
self.view.setContentHuggingPriority(LayoutPriority(rawValue: newValue), for: .horizontal)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public var contentHuggingVerticalPriority: Float {
|
||||||
|
get {
|
||||||
|
return self.view.contentHuggingPriority(for: .vertical).rawValue
|
||||||
|
}
|
||||||
|
nonmutating set {
|
||||||
|
self.view.setContentHuggingPriority(LayoutPriority(rawValue: newValue), for: .vertical)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public var contentCompressionResistanceHorizontalPriority: Float {
|
||||||
|
get {
|
||||||
|
return self.view.contentCompressionResistancePriority(for: .horizontal).rawValue
|
||||||
|
}
|
||||||
|
nonmutating set {
|
||||||
|
self.view.setContentCompressionResistancePriority(LayoutPriority(rawValue: newValue), for: .horizontal)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public var contentCompressionResistanceVerticalPriority: Float {
|
||||||
|
get {
|
||||||
|
return self.view.contentCompressionResistancePriority(for: .vertical).rawValue
|
||||||
|
}
|
||||||
|
nonmutating set {
|
||||||
|
self.view.setContentCompressionResistancePriority(LayoutPriority(rawValue: newValue), for: .vertical)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public var target: AnyObject? {
|
||||||
|
return self.view
|
||||||
|
}
|
||||||
|
|
||||||
|
internal let view: ConstraintView
|
||||||
|
|
||||||
|
internal init(view: ConstraintView) {
|
||||||
|
self.view = view
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+169
@@ -0,0 +1,169 @@
|
|||||||
|
//
|
||||||
|
// SnapKit
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
|
||||||
|
#if canImport(UIKit)
|
||||||
|
import UIKit
|
||||||
|
#else
|
||||||
|
import AppKit
|
||||||
|
#endif
|
||||||
|
|
||||||
|
public extension LayoutConstraint {
|
||||||
|
|
||||||
|
override var description: String {
|
||||||
|
var description = "<"
|
||||||
|
|
||||||
|
description += descriptionForObject(self)
|
||||||
|
|
||||||
|
if let firstItem = conditionalOptional(from: self.firstItem) {
|
||||||
|
description += " \(descriptionForObject(firstItem))"
|
||||||
|
}
|
||||||
|
|
||||||
|
if self.firstAttribute != .notAnAttribute {
|
||||||
|
description += ".\(descriptionForAttribute(self.firstAttribute))"
|
||||||
|
}
|
||||||
|
|
||||||
|
description += " \(descriptionForRelation(self.relation))"
|
||||||
|
|
||||||
|
if let secondItem = self.secondItem {
|
||||||
|
description += " \(descriptionForObject(secondItem))"
|
||||||
|
}
|
||||||
|
|
||||||
|
if self.secondAttribute != .notAnAttribute {
|
||||||
|
description += ".\(descriptionForAttribute(self.secondAttribute))"
|
||||||
|
}
|
||||||
|
|
||||||
|
if self.multiplier != 1.0 {
|
||||||
|
description += " * \(self.multiplier)"
|
||||||
|
}
|
||||||
|
|
||||||
|
if self.secondAttribute == .notAnAttribute {
|
||||||
|
description += " \(self.constant)"
|
||||||
|
} else {
|
||||||
|
if self.constant > 0.0 {
|
||||||
|
description += " + \(self.constant)"
|
||||||
|
} else if self.constant < 0.0 {
|
||||||
|
description += " - \(abs(self.constant))"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if self.priority.rawValue != 1000.0 {
|
||||||
|
description += " ^\(self.priority)"
|
||||||
|
}
|
||||||
|
|
||||||
|
description += ">"
|
||||||
|
|
||||||
|
return description
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private func descriptionForRelation(_ relation: LayoutRelation) -> String {
|
||||||
|
switch relation {
|
||||||
|
case .equal: return "=="
|
||||||
|
case .greaterThanOrEqual: return ">="
|
||||||
|
case .lessThanOrEqual: return "<="
|
||||||
|
#if swift(>=5.0)
|
||||||
|
@unknown default: return "unknown"
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private func descriptionForAttribute(_ attribute: LayoutAttribute) -> String {
|
||||||
|
#if canImport(UIKit)
|
||||||
|
switch attribute {
|
||||||
|
case .notAnAttribute: return "notAnAttribute"
|
||||||
|
case .top: return "top"
|
||||||
|
case .left: return "left"
|
||||||
|
case .bottom: return "bottom"
|
||||||
|
case .right: return "right"
|
||||||
|
case .leading: return "leading"
|
||||||
|
case .trailing: return "trailing"
|
||||||
|
case .width: return "width"
|
||||||
|
case .height: return "height"
|
||||||
|
case .centerX: return "centerX"
|
||||||
|
case .centerY: return "centerY"
|
||||||
|
case .lastBaseline: return "lastBaseline"
|
||||||
|
case .firstBaseline: return "firstBaseline"
|
||||||
|
case .topMargin: return "topMargin"
|
||||||
|
case .leftMargin: return "leftMargin"
|
||||||
|
case .bottomMargin: return "bottomMargin"
|
||||||
|
case .rightMargin: return "rightMargin"
|
||||||
|
case .leadingMargin: return "leadingMargin"
|
||||||
|
case .trailingMargin: return "trailingMargin"
|
||||||
|
case .centerXWithinMargins: return "centerXWithinMargins"
|
||||||
|
case .centerYWithinMargins: return "centerYWithinMargins"
|
||||||
|
#if swift(>=5.0)
|
||||||
|
@unknown default: return "unknown"
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
switch attribute {
|
||||||
|
case .notAnAttribute: return "notAnAttribute"
|
||||||
|
case .top: return "top"
|
||||||
|
case .left: return "left"
|
||||||
|
case .bottom: return "bottom"
|
||||||
|
case .right: return "right"
|
||||||
|
case .leading: return "leading"
|
||||||
|
case .trailing: return "trailing"
|
||||||
|
case .width: return "width"
|
||||||
|
case .height: return "height"
|
||||||
|
case .centerX: return "centerX"
|
||||||
|
case .centerY: return "centerY"
|
||||||
|
case .lastBaseline: return "lastBaseline"
|
||||||
|
case .firstBaseline: return "firstBaseline"
|
||||||
|
#if swift(>=5.0)
|
||||||
|
@unknown default: return "unknown"
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
private func conditionalOptional<T>(from object: Optional<T>) -> Optional<T> {
|
||||||
|
return object
|
||||||
|
}
|
||||||
|
|
||||||
|
private func conditionalOptional<T>(from object: T) -> Optional<T> {
|
||||||
|
return Optional.some(object)
|
||||||
|
}
|
||||||
|
|
||||||
|
private func descriptionForObject(_ object: AnyObject) -> String {
|
||||||
|
let pointerDescription = String(format: "%p", UInt(bitPattern: ObjectIdentifier(object)))
|
||||||
|
var desc = ""
|
||||||
|
|
||||||
|
desc += type(of: object).description()
|
||||||
|
|
||||||
|
if let object = object as? ConstraintView {
|
||||||
|
desc += ":\(object.snp.label() ?? pointerDescription)"
|
||||||
|
} else if let object = object as? LayoutConstraint {
|
||||||
|
desc += ":\(object.label ?? pointerDescription)"
|
||||||
|
} else {
|
||||||
|
desc += ":\(pointerDescription)"
|
||||||
|
}
|
||||||
|
|
||||||
|
if let object = object as? LayoutConstraint, let file = object.constraint?.sourceLocation.0, let line = object.constraint?.sourceLocation.1 {
|
||||||
|
desc += "@\((file as NSString).lastPathComponent)#\(line)"
|
||||||
|
}
|
||||||
|
|
||||||
|
desc += ""
|
||||||
|
return desc
|
||||||
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
//
|
||||||
|
// SnapKit
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
|
||||||
|
#if canImport(UIKit)
|
||||||
|
import UIKit
|
||||||
|
#else
|
||||||
|
import AppKit
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
public class LayoutConstraint : NSLayoutConstraint {
|
||||||
|
|
||||||
|
public var label: String? {
|
||||||
|
get {
|
||||||
|
return self.identifier
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
self.identifier = newValue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal weak var constraint: Constraint? = nil
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
internal func ==(lhs: LayoutConstraint, rhs: LayoutConstraint) -> Bool {
|
||||||
|
// If firstItem or secondItem on either constraint has a dangling pointer
|
||||||
|
// this comparison can cause a crash. The solution for this is to ensure
|
||||||
|
// your layout code hold strong references to things like Views, LayoutGuides
|
||||||
|
// and LayoutAnchors as SnapKit will not keep strong references to any of these.
|
||||||
|
guard lhs.firstAttribute == rhs.firstAttribute &&
|
||||||
|
lhs.secondAttribute == rhs.secondAttribute &&
|
||||||
|
lhs.relation == rhs.relation &&
|
||||||
|
lhs.priority == rhs.priority &&
|
||||||
|
lhs.multiplier == rhs.multiplier &&
|
||||||
|
lhs.secondItem === rhs.secondItem &&
|
||||||
|
lhs.firstItem === rhs.firstItem else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
@@ -0,0 +1,93 @@
|
|||||||
|
//
|
||||||
|
// SnapKit
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
|
||||||
|
#if canImport(UIKit)
|
||||||
|
import UIKit
|
||||||
|
#else
|
||||||
|
import AppKit
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
public protocol LayoutConstraintItem: AnyObject {
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 9.0, OSX 10.11, *)
|
||||||
|
extension ConstraintLayoutGuide : LayoutConstraintItem {
|
||||||
|
}
|
||||||
|
|
||||||
|
extension ConstraintView : LayoutConstraintItem {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
extension LayoutConstraintItem {
|
||||||
|
|
||||||
|
internal func prepare() {
|
||||||
|
if let view = self as? ConstraintView {
|
||||||
|
view.translatesAutoresizingMaskIntoConstraints = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal var superview: ConstraintView? {
|
||||||
|
if let view = self as? ConstraintView {
|
||||||
|
return view.superview
|
||||||
|
}
|
||||||
|
|
||||||
|
if #available(iOS 9.0, OSX 10.11, *), let guide = self as? ConstraintLayoutGuide {
|
||||||
|
return guide.owningView
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
internal var constraints: [Constraint] {
|
||||||
|
return self.constraintsSet.allObjects as! [Constraint]
|
||||||
|
}
|
||||||
|
|
||||||
|
internal func add(constraints: [Constraint]) {
|
||||||
|
let constraintsSet = self.constraintsSet
|
||||||
|
for constraint in constraints {
|
||||||
|
constraintsSet.add(constraint)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal func remove(constraints: [Constraint]) {
|
||||||
|
let constraintsSet = self.constraintsSet
|
||||||
|
for constraint in constraints {
|
||||||
|
constraintsSet.remove(constraint)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private var constraintsSet: NSMutableSet {
|
||||||
|
let constraintsSet: NSMutableSet
|
||||||
|
|
||||||
|
if let existing = objc_getAssociatedObject(self, &constraintsKey) as? NSMutableSet {
|
||||||
|
constraintsSet = existing
|
||||||
|
} else {
|
||||||
|
constraintsSet = NSMutableSet()
|
||||||
|
objc_setAssociatedObject(self, &constraintsKey, constraintsSet, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)
|
||||||
|
}
|
||||||
|
return constraintsSet
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
private var constraintsKey: UInt8 = 0
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>NSPrivacyTracking</key>
|
||||||
|
<false/>
|
||||||
|
<key>NSPrivacyAccessedAPITypes</key>
|
||||||
|
<array/>
|
||||||
|
<key>NSPrivacyCollectedDataTypes</key>
|
||||||
|
<array/>
|
||||||
|
<key>NSPrivacyTrackingDomains</key>
|
||||||
|
<array/>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
+42
@@ -0,0 +1,42 @@
|
|||||||
|
//
|
||||||
|
// SnapKit
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
#if canImport(UIKit)
|
||||||
|
import UIKit
|
||||||
|
#if swift(>=4.2)
|
||||||
|
typealias LayoutRelation = NSLayoutConstraint.Relation
|
||||||
|
typealias LayoutAttribute = NSLayoutConstraint.Attribute
|
||||||
|
#else
|
||||||
|
typealias LayoutRelation = NSLayoutRelation
|
||||||
|
typealias LayoutAttribute = NSLayoutAttribute
|
||||||
|
#endif
|
||||||
|
typealias LayoutPriority = UILayoutPriority
|
||||||
|
#else
|
||||||
|
import AppKit
|
||||||
|
typealias LayoutRelation = NSLayoutConstraint.Relation
|
||||||
|
typealias LayoutAttribute = NSLayoutConstraint.Attribute
|
||||||
|
typealias LayoutPriority = NSLayoutConstraint.Priority
|
||||||
|
#endif
|
||||||
|
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
//
|
||||||
|
// SnapKit
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
|
||||||
|
#if canImport(UIKit)
|
||||||
|
import UIKit
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
public extension ConstraintLayoutSupport {
|
||||||
|
|
||||||
|
var snp: ConstraintLayoutSupportDSL {
|
||||||
|
return ConstraintLayoutSupportDSL(support: self)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
ReadViewDemo/Pods/Target Support Files/Pods-ReadViewDemo/Pods-ReadViewDemo-acknowledgements.markdown
Generated
+23
@@ -53,6 +53,29 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
|
||||||
|
## SnapKit
|
||||||
|
|
||||||
|
Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
|
||||||
|
|
||||||
## ZIPFoundation
|
## ZIPFoundation
|
||||||
|
|
||||||
MIT License
|
MIT License
|
||||||
|
|||||||
Generated
+29
@@ -76,6 +76,35 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
<key>Type</key>
|
<key>Type</key>
|
||||||
<string>PSGroupSpecifier</string>
|
<string>PSGroupSpecifier</string>
|
||||||
</dict>
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>FooterText</key>
|
||||||
|
<string>Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
</string>
|
||||||
|
<key>License</key>
|
||||||
|
<string>MIT</string>
|
||||||
|
<key>Title</key>
|
||||||
|
<string>SnapKit</string>
|
||||||
|
<key>Type</key>
|
||||||
|
<string>PSGroupSpecifier</string>
|
||||||
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
<key>FooterText</key>
|
<key>FooterText</key>
|
||||||
<string>MIT License
|
<string>MIT License
|
||||||
|
|||||||
+2
@@ -2,4 +2,6 @@ ${PODS_ROOT}/Target Support Files/Pods-ReadViewDemo/Pods-ReadViewDemo-frameworks
|
|||||||
${BUILT_PRODUCTS_DIR}/DTCoreText/DTCoreText.framework
|
${BUILT_PRODUCTS_DIR}/DTCoreText/DTCoreText.framework
|
||||||
${BUILT_PRODUCTS_DIR}/DTFoundation/DTFoundation.framework
|
${BUILT_PRODUCTS_DIR}/DTFoundation/DTFoundation.framework
|
||||||
${BUILT_PRODUCTS_DIR}/RDEpubReaderView/RDEpubReaderView.framework
|
${BUILT_PRODUCTS_DIR}/RDEpubReaderView/RDEpubReaderView.framework
|
||||||
|
${BUILT_PRODUCTS_DIR}/RDPDFReaderView/RDPDFReaderView.framework
|
||||||
|
${BUILT_PRODUCTS_DIR}/SnapKit/SnapKit.framework
|
||||||
${BUILT_PRODUCTS_DIR}/ZIPFoundation/ZIPFoundation.framework
|
${BUILT_PRODUCTS_DIR}/ZIPFoundation/ZIPFoundation.framework
|
||||||
+2
@@ -1,4 +1,6 @@
|
|||||||
${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/DTCoreText.framework
|
${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/DTCoreText.framework
|
||||||
${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/DTFoundation.framework
|
${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/DTFoundation.framework
|
||||||
${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RDEpubReaderView.framework
|
${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RDEpubReaderView.framework
|
||||||
|
${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RDPDFReaderView.framework
|
||||||
|
${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SnapKit.framework
|
||||||
${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ZIPFoundation.framework
|
${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ZIPFoundation.framework
|
||||||
+2
@@ -2,4 +2,6 @@ ${PODS_ROOT}/Target Support Files/Pods-ReadViewDemo/Pods-ReadViewDemo-frameworks
|
|||||||
${BUILT_PRODUCTS_DIR}/DTCoreText/DTCoreText.framework
|
${BUILT_PRODUCTS_DIR}/DTCoreText/DTCoreText.framework
|
||||||
${BUILT_PRODUCTS_DIR}/DTFoundation/DTFoundation.framework
|
${BUILT_PRODUCTS_DIR}/DTFoundation/DTFoundation.framework
|
||||||
${BUILT_PRODUCTS_DIR}/RDEpubReaderView/RDEpubReaderView.framework
|
${BUILT_PRODUCTS_DIR}/RDEpubReaderView/RDEpubReaderView.framework
|
||||||
|
${BUILT_PRODUCTS_DIR}/RDPDFReaderView/RDPDFReaderView.framework
|
||||||
|
${BUILT_PRODUCTS_DIR}/SnapKit/SnapKit.framework
|
||||||
${BUILT_PRODUCTS_DIR}/ZIPFoundation/ZIPFoundation.framework
|
${BUILT_PRODUCTS_DIR}/ZIPFoundation/ZIPFoundation.framework
|
||||||
+2
@@ -1,4 +1,6 @@
|
|||||||
${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/DTCoreText.framework
|
${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/DTCoreText.framework
|
||||||
${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/DTFoundation.framework
|
${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/DTFoundation.framework
|
||||||
${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RDEpubReaderView.framework
|
${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RDEpubReaderView.framework
|
||||||
|
${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RDPDFReaderView.framework
|
||||||
|
${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SnapKit.framework
|
||||||
${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ZIPFoundation.framework
|
${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ZIPFoundation.framework
|
||||||
+4
@@ -179,12 +179,16 @@ if [[ "$CONFIGURATION" == "Debug" ]]; then
|
|||||||
install_framework "${BUILT_PRODUCTS_DIR}/DTCoreText/DTCoreText.framework"
|
install_framework "${BUILT_PRODUCTS_DIR}/DTCoreText/DTCoreText.framework"
|
||||||
install_framework "${BUILT_PRODUCTS_DIR}/DTFoundation/DTFoundation.framework"
|
install_framework "${BUILT_PRODUCTS_DIR}/DTFoundation/DTFoundation.framework"
|
||||||
install_framework "${BUILT_PRODUCTS_DIR}/RDEpubReaderView/RDEpubReaderView.framework"
|
install_framework "${BUILT_PRODUCTS_DIR}/RDEpubReaderView/RDEpubReaderView.framework"
|
||||||
|
install_framework "${BUILT_PRODUCTS_DIR}/RDPDFReaderView/RDPDFReaderView.framework"
|
||||||
|
install_framework "${BUILT_PRODUCTS_DIR}/SnapKit/SnapKit.framework"
|
||||||
install_framework "${BUILT_PRODUCTS_DIR}/ZIPFoundation/ZIPFoundation.framework"
|
install_framework "${BUILT_PRODUCTS_DIR}/ZIPFoundation/ZIPFoundation.framework"
|
||||||
fi
|
fi
|
||||||
if [[ "$CONFIGURATION" == "Release" ]]; then
|
if [[ "$CONFIGURATION" == "Release" ]]; then
|
||||||
install_framework "${BUILT_PRODUCTS_DIR}/DTCoreText/DTCoreText.framework"
|
install_framework "${BUILT_PRODUCTS_DIR}/DTCoreText/DTCoreText.framework"
|
||||||
install_framework "${BUILT_PRODUCTS_DIR}/DTFoundation/DTFoundation.framework"
|
install_framework "${BUILT_PRODUCTS_DIR}/DTFoundation/DTFoundation.framework"
|
||||||
install_framework "${BUILT_PRODUCTS_DIR}/RDEpubReaderView/RDEpubReaderView.framework"
|
install_framework "${BUILT_PRODUCTS_DIR}/RDEpubReaderView/RDEpubReaderView.framework"
|
||||||
|
install_framework "${BUILT_PRODUCTS_DIR}/RDPDFReaderView/RDPDFReaderView.framework"
|
||||||
|
install_framework "${BUILT_PRODUCTS_DIR}/SnapKit/SnapKit.framework"
|
||||||
install_framework "${BUILT_PRODUCTS_DIR}/ZIPFoundation/ZIPFoundation.framework"
|
install_framework "${BUILT_PRODUCTS_DIR}/ZIPFoundation/ZIPFoundation.framework"
|
||||||
fi
|
fi
|
||||||
if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then
|
if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then
|
||||||
|
|||||||
+2
@@ -0,0 +1,2 @@
|
|||||||
|
${PODS_ROOT}/Target Support Files/Pods-ReadViewDemo/Pods-ReadViewDemo-resources.sh
|
||||||
|
${PODS_CONFIGURATION_BUILD_DIR}/RDEpubReaderView/RDEpubReaderViewAssets.bundle
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/RDEpubReaderViewAssets.bundle
|
||||||
+2
@@ -0,0 +1,2 @@
|
|||||||
|
${PODS_ROOT}/Target Support Files/Pods-ReadViewDemo/Pods-ReadViewDemo-resources.sh
|
||||||
|
${PODS_CONFIGURATION_BUILD_DIR}/RDEpubReaderView/RDEpubReaderViewAssets.bundle
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/RDEpubReaderViewAssets.bundle
|
||||||
Generated
Executable
+129
@@ -0,0 +1,129 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
set -u
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
|
function on_error {
|
||||||
|
echo "$(realpath -mq "${0}"):$1: error: Unexpected failure"
|
||||||
|
}
|
||||||
|
trap 'on_error $LINENO' ERR
|
||||||
|
|
||||||
|
if [ -z ${UNLOCALIZED_RESOURCES_FOLDER_PATH+x} ]; then
|
||||||
|
# If UNLOCALIZED_RESOURCES_FOLDER_PATH is not set, then there's nowhere for us to copy
|
||||||
|
# resources to, so exit 0 (signalling the script phase was successful).
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
|
||||||
|
|
||||||
|
RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt
|
||||||
|
> "$RESOURCES_TO_COPY"
|
||||||
|
|
||||||
|
XCASSET_FILES=()
|
||||||
|
|
||||||
|
# This protects against multiple targets copying the same framework dependency at the same time. The solution
|
||||||
|
# was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html
|
||||||
|
RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????")
|
||||||
|
|
||||||
|
case "${TARGETED_DEVICE_FAMILY:-}" in
|
||||||
|
1,2)
|
||||||
|
TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone"
|
||||||
|
;;
|
||||||
|
1)
|
||||||
|
TARGET_DEVICE_ARGS="--target-device iphone"
|
||||||
|
;;
|
||||||
|
2)
|
||||||
|
TARGET_DEVICE_ARGS="--target-device ipad"
|
||||||
|
;;
|
||||||
|
3)
|
||||||
|
TARGET_DEVICE_ARGS="--target-device tv"
|
||||||
|
;;
|
||||||
|
4)
|
||||||
|
TARGET_DEVICE_ARGS="--target-device watch"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
TARGET_DEVICE_ARGS="--target-device mac"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
install_resource()
|
||||||
|
{
|
||||||
|
if [[ "$1" = /* ]] ; then
|
||||||
|
RESOURCE_PATH="$1"
|
||||||
|
else
|
||||||
|
RESOURCE_PATH="${PODS_ROOT}/$1"
|
||||||
|
fi
|
||||||
|
if [[ ! -e "$RESOURCE_PATH" ]] ; then
|
||||||
|
cat << EOM
|
||||||
|
error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script.
|
||||||
|
EOM
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
case $RESOURCE_PATH in
|
||||||
|
*.storyboard)
|
||||||
|
echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" || true
|
||||||
|
ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS}
|
||||||
|
;;
|
||||||
|
*.xib)
|
||||||
|
echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" || true
|
||||||
|
ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS}
|
||||||
|
;;
|
||||||
|
*.framework)
|
||||||
|
echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true
|
||||||
|
mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
|
||||||
|
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true
|
||||||
|
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
|
||||||
|
;;
|
||||||
|
*.xcdatamodel)
|
||||||
|
echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\"" || true
|
||||||
|
xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom"
|
||||||
|
;;
|
||||||
|
*.xcdatamodeld)
|
||||||
|
echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\"" || true
|
||||||
|
xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd"
|
||||||
|
;;
|
||||||
|
*.xcmappingmodel)
|
||||||
|
echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\"" || true
|
||||||
|
xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm"
|
||||||
|
;;
|
||||||
|
*.xcassets)
|
||||||
|
ABSOLUTE_XCASSET_FILE="$RESOURCE_PATH"
|
||||||
|
XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE")
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "$RESOURCE_PATH" || true
|
||||||
|
echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
if [[ "$CONFIGURATION" == "Debug" ]]; then
|
||||||
|
install_resource "${PODS_CONFIGURATION_BUILD_DIR}/RDEpubReaderView/RDEpubReaderViewAssets.bundle"
|
||||||
|
fi
|
||||||
|
if [[ "$CONFIGURATION" == "Release" ]]; then
|
||||||
|
install_resource "${PODS_CONFIGURATION_BUILD_DIR}/RDEpubReaderView/RDEpubReaderViewAssets.bundle"
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
|
||||||
|
rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
|
||||||
|
if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then
|
||||||
|
mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
|
||||||
|
rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
|
||||||
|
fi
|
||||||
|
rm -f "$RESOURCES_TO_COPY"
|
||||||
|
|
||||||
|
if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "${XCASSET_FILES:-}" ]
|
||||||
|
then
|
||||||
|
# Find all other xcassets (this unfortunately includes those of path pods and other targets).
|
||||||
|
OTHER_XCASSETS=$(find -L "$PWD" -iname "*.xcassets" -type d)
|
||||||
|
while read line; do
|
||||||
|
if [[ $line != "${PODS_ROOT}*" ]]; then
|
||||||
|
XCASSET_FILES+=("$line")
|
||||||
|
fi
|
||||||
|
done <<<"$OTHER_XCASSETS"
|
||||||
|
|
||||||
|
if [ -z ${ASSETCATALOG_COMPILER_APPICON_NAME+x} ]; then
|
||||||
|
printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
|
||||||
|
else
|
||||||
|
printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" --app-icon "${ASSETCATALOG_COMPILER_APPICON_NAME}" --output-partial-info-plist "${TARGET_TEMP_DIR}/assetcatalog_generated_info_cocoapods.plist"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
+5
-5
@@ -1,12 +1,12 @@
|
|||||||
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES
|
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES
|
||||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO
|
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO
|
||||||
FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/DTCoreText" "${PODS_CONFIGURATION_BUILD_DIR}/DTFoundation" "${PODS_CONFIGURATION_BUILD_DIR}/RDEpubReaderView" "${PODS_CONFIGURATION_BUILD_DIR}/ZIPFoundation"
|
FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/DTCoreText" "${PODS_CONFIGURATION_BUILD_DIR}/DTFoundation" "${PODS_CONFIGURATION_BUILD_DIR}/RDEpubReaderView" "${PODS_CONFIGURATION_BUILD_DIR}/RDPDFReaderView" "${PODS_CONFIGURATION_BUILD_DIR}/SnapKit" "${PODS_CONFIGURATION_BUILD_DIR}/ZIPFoundation"
|
||||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||||
HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/DTCoreText/DTCoreText.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/DTFoundation/DTFoundation.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/RDEpubReaderView/RDEpubReaderView.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/ZIPFoundation/ZIPFoundation.framework/Headers" "$(SDKROOT)/usr/include/libxml2"
|
HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/DTCoreText/DTCoreText.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/DTFoundation/DTFoundation.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/RDEpubReaderView/RDEpubReaderView.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/RDPDFReaderView/RDPDFReaderView.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/SnapKit/SnapKit.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/ZIPFoundation/ZIPFoundation.framework/Headers" "$(SDKROOT)/usr/include/libxml2"
|
||||||
LD_RUNPATH_SEARCH_PATHS = $(inherited) /usr/lib/swift '@executable_path/Frameworks' '@loader_path/Frameworks'
|
LD_RUNPATH_SEARCH_PATHS = $(inherited) /usr/lib/swift '@executable_path/Frameworks' '@loader_path/Frameworks'
|
||||||
LIBRARY_SEARCH_PATHS = $(inherited) "${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift
|
LIBRARY_SEARCH_PATHS = $(inherited) "${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift $(SDKROOT)/usr/lib/swift
|
||||||
OTHER_LDFLAGS = $(inherited) -l"xml2" -framework "CoreGraphics" -framework "CoreText" -framework "DTCoreText" -framework "DTFoundation" -framework "ImageIO" -framework "MediaPlayer" -framework "QuartzCore" -framework "RDEpubReaderView" -framework "ZIPFoundation"
|
OTHER_LDFLAGS = $(inherited) -l"swiftCoreGraphics" -l"xml2" -framework "CoreGraphics" -framework "CoreImage" -framework "CoreText" -framework "DTCoreText" -framework "DTFoundation" -framework "ImageIO" -framework "MediaPlayer" -framework "PDFKit" -framework "QuartzCore" -framework "RDEpubReaderView" -framework "RDPDFReaderView" -framework "SnapKit" -framework "Vision" -framework "ZIPFoundation"
|
||||||
OTHER_MODULE_VERIFIER_FLAGS = $(inherited) "-F${PODS_CONFIGURATION_BUILD_DIR}/DTCoreText" "-F${PODS_CONFIGURATION_BUILD_DIR}/DTFoundation" "-F${PODS_CONFIGURATION_BUILD_DIR}/RDEpubReaderView" "-F${PODS_CONFIGURATION_BUILD_DIR}/ZIPFoundation"
|
OTHER_MODULE_VERIFIER_FLAGS = $(inherited) "-F${PODS_CONFIGURATION_BUILD_DIR}/DTCoreText" "-F${PODS_CONFIGURATION_BUILD_DIR}/DTFoundation" "-F${PODS_CONFIGURATION_BUILD_DIR}/RDEpubReaderView" "-F${PODS_CONFIGURATION_BUILD_DIR}/RDPDFReaderView" "-F${PODS_CONFIGURATION_BUILD_DIR}/SnapKit" "-F${PODS_CONFIGURATION_BUILD_DIR}/ZIPFoundation"
|
||||||
OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
|
OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
|
||||||
PODS_BUILD_DIR = ${BUILD_DIR}
|
PODS_BUILD_DIR = ${BUILD_DIR}
|
||||||
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||||
|
|||||||
Generated
+5
-5
@@ -1,12 +1,12 @@
|
|||||||
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES
|
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES
|
||||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO
|
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO
|
||||||
FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/DTCoreText" "${PODS_CONFIGURATION_BUILD_DIR}/DTFoundation" "${PODS_CONFIGURATION_BUILD_DIR}/RDEpubReaderView" "${PODS_CONFIGURATION_BUILD_DIR}/ZIPFoundation"
|
FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/DTCoreText" "${PODS_CONFIGURATION_BUILD_DIR}/DTFoundation" "${PODS_CONFIGURATION_BUILD_DIR}/RDEpubReaderView" "${PODS_CONFIGURATION_BUILD_DIR}/RDPDFReaderView" "${PODS_CONFIGURATION_BUILD_DIR}/SnapKit" "${PODS_CONFIGURATION_BUILD_DIR}/ZIPFoundation"
|
||||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||||
HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/DTCoreText/DTCoreText.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/DTFoundation/DTFoundation.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/RDEpubReaderView/RDEpubReaderView.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/ZIPFoundation/ZIPFoundation.framework/Headers" "$(SDKROOT)/usr/include/libxml2"
|
HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/DTCoreText/DTCoreText.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/DTFoundation/DTFoundation.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/RDEpubReaderView/RDEpubReaderView.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/RDPDFReaderView/RDPDFReaderView.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/SnapKit/SnapKit.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/ZIPFoundation/ZIPFoundation.framework/Headers" "$(SDKROOT)/usr/include/libxml2"
|
||||||
LD_RUNPATH_SEARCH_PATHS = $(inherited) /usr/lib/swift '@executable_path/Frameworks' '@loader_path/Frameworks'
|
LD_RUNPATH_SEARCH_PATHS = $(inherited) /usr/lib/swift '@executable_path/Frameworks' '@loader_path/Frameworks'
|
||||||
LIBRARY_SEARCH_PATHS = $(inherited) "${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift
|
LIBRARY_SEARCH_PATHS = $(inherited) "${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift $(SDKROOT)/usr/lib/swift
|
||||||
OTHER_LDFLAGS = $(inherited) -l"xml2" -framework "CoreGraphics" -framework "CoreText" -framework "DTCoreText" -framework "DTFoundation" -framework "ImageIO" -framework "MediaPlayer" -framework "QuartzCore" -framework "RDEpubReaderView" -framework "ZIPFoundation"
|
OTHER_LDFLAGS = $(inherited) -l"swiftCoreGraphics" -l"xml2" -framework "CoreGraphics" -framework "CoreImage" -framework "CoreText" -framework "DTCoreText" -framework "DTFoundation" -framework "ImageIO" -framework "MediaPlayer" -framework "PDFKit" -framework "QuartzCore" -framework "RDEpubReaderView" -framework "RDPDFReaderView" -framework "SnapKit" -framework "Vision" -framework "ZIPFoundation"
|
||||||
OTHER_MODULE_VERIFIER_FLAGS = $(inherited) "-F${PODS_CONFIGURATION_BUILD_DIR}/DTCoreText" "-F${PODS_CONFIGURATION_BUILD_DIR}/DTFoundation" "-F${PODS_CONFIGURATION_BUILD_DIR}/RDEpubReaderView" "-F${PODS_CONFIGURATION_BUILD_DIR}/ZIPFoundation"
|
OTHER_MODULE_VERIFIER_FLAGS = $(inherited) "-F${PODS_CONFIGURATION_BUILD_DIR}/DTCoreText" "-F${PODS_CONFIGURATION_BUILD_DIR}/DTFoundation" "-F${PODS_CONFIGURATION_BUILD_DIR}/RDEpubReaderView" "-F${PODS_CONFIGURATION_BUILD_DIR}/RDPDFReaderView" "-F${PODS_CONFIGURATION_BUILD_DIR}/SnapKit" "-F${PODS_CONFIGURATION_BUILD_DIR}/ZIPFoundation"
|
||||||
OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
|
OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
|
||||||
PODS_BUILD_DIR = ${BUILD_DIR}
|
PODS_BUILD_DIR = ${BUILD_DIR}
|
||||||
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||||
|
|||||||
+1
-1
@@ -15,7 +15,7 @@
|
|||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>FMWK</string>
|
<string>FMWK</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>0.0.1</string>
|
<string>0.0.2</string>
|
||||||
<key>CFBundleSignature</key>
|
<key>CFBundleSignature</key>
|
||||||
<string>????</string>
|
<string>????</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
|
|||||||
+3
-3
@@ -1,15 +1,15 @@
|
|||||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO
|
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO
|
||||||
CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/RDEpubReaderView
|
CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/RDEpubReaderView
|
||||||
FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/DTCoreText" "${PODS_CONFIGURATION_BUILD_DIR}/DTFoundation" "${PODS_CONFIGURATION_BUILD_DIR}/ZIPFoundation"
|
FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/DTCoreText" "${PODS_CONFIGURATION_BUILD_DIR}/DTFoundation" "${PODS_CONFIGURATION_BUILD_DIR}/SnapKit" "${PODS_CONFIGURATION_BUILD_DIR}/ZIPFoundation"
|
||||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||||
LIBRARY_SEARCH_PATHS = $(inherited) "${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift
|
LIBRARY_SEARCH_PATHS = $(inherited) "${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift
|
||||||
OTHER_LDFLAGS = $(inherited) -framework "CoreGraphics" -framework "CoreText" -framework "DTCoreText" -framework "ImageIO" -framework "MediaPlayer" -framework "QuartzCore" -framework "ZIPFoundation"
|
OTHER_LDFLAGS = $(inherited) -framework "CoreGraphics" -framework "CoreText" -framework "DTCoreText" -framework "ImageIO" -framework "MediaPlayer" -framework "QuartzCore" -framework "SnapKit" -framework "ZIPFoundation"
|
||||||
OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
|
OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
|
||||||
PODS_BUILD_DIR = ${BUILD_DIR}
|
PODS_BUILD_DIR = ${BUILD_DIR}
|
||||||
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||||
PODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}
|
PODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}
|
||||||
PODS_ROOT = ${SRCROOT}
|
PODS_ROOT = ${SRCROOT}
|
||||||
PODS_TARGET_SRCROOT = ${PODS_ROOT}/../..
|
PODS_TARGET_SRCROOT = ${PODS_ROOT}/../../Sources/RDEpubReaderView
|
||||||
PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates
|
PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
|
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
|
||||||
SKIP_INSTALL = YES
|
SKIP_INSTALL = YES
|
||||||
|
|||||||
+3
-3
@@ -1,15 +1,15 @@
|
|||||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO
|
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO
|
||||||
CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/RDEpubReaderView
|
CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/RDEpubReaderView
|
||||||
FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/DTCoreText" "${PODS_CONFIGURATION_BUILD_DIR}/DTFoundation" "${PODS_CONFIGURATION_BUILD_DIR}/ZIPFoundation"
|
FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/DTCoreText" "${PODS_CONFIGURATION_BUILD_DIR}/DTFoundation" "${PODS_CONFIGURATION_BUILD_DIR}/SnapKit" "${PODS_CONFIGURATION_BUILD_DIR}/ZIPFoundation"
|
||||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||||
LIBRARY_SEARCH_PATHS = $(inherited) "${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift
|
LIBRARY_SEARCH_PATHS = $(inherited) "${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift
|
||||||
OTHER_LDFLAGS = $(inherited) -framework "CoreGraphics" -framework "CoreText" -framework "DTCoreText" -framework "ImageIO" -framework "MediaPlayer" -framework "QuartzCore" -framework "ZIPFoundation"
|
OTHER_LDFLAGS = $(inherited) -framework "CoreGraphics" -framework "CoreText" -framework "DTCoreText" -framework "ImageIO" -framework "MediaPlayer" -framework "QuartzCore" -framework "SnapKit" -framework "ZIPFoundation"
|
||||||
OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
|
OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
|
||||||
PODS_BUILD_DIR = ${BUILD_DIR}
|
PODS_BUILD_DIR = ${BUILD_DIR}
|
||||||
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||||
PODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}
|
PODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}
|
||||||
PODS_ROOT = ${SRCROOT}
|
PODS_ROOT = ${SRCROOT}
|
||||||
PODS_TARGET_SRCROOT = ${PODS_ROOT}/../..
|
PODS_TARGET_SRCROOT = ${PODS_ROOT}/../../Sources/RDEpubReaderView
|
||||||
PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates
|
PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
|
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
|
||||||
SKIP_INSTALL = YES
|
SKIP_INSTALL = YES
|
||||||
|
|||||||
+1
-1
@@ -13,7 +13,7 @@
|
|||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>BNDL</string>
|
<string>BNDL</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>0.0.1</string>
|
<string>0.0.2</string>
|
||||||
<key>CFBundleSignature</key>
|
<key>CFBundleSignature</key>
|
||||||
<string>????</string>
|
<string>????</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
|
|||||||
+26
@@ -0,0 +1,26 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
|
<string>${PODS_DEVELOPMENT_LANGUAGE}</string>
|
||||||
|
<key>CFBundleExecutable</key>
|
||||||
|
<string>${EXECUTABLE_NAME}</string>
|
||||||
|
<key>CFBundleIdentifier</key>
|
||||||
|
<string>${PRODUCT_BUNDLE_IDENTIFIER}</string>
|
||||||
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
|
<string>6.0</string>
|
||||||
|
<key>CFBundleName</key>
|
||||||
|
<string>${PRODUCT_NAME}</string>
|
||||||
|
<key>CFBundlePackageType</key>
|
||||||
|
<string>FMWK</string>
|
||||||
|
<key>CFBundleShortVersionString</key>
|
||||||
|
<string>0.0.1</string>
|
||||||
|
<key>CFBundleSignature</key>
|
||||||
|
<string>????</string>
|
||||||
|
<key>CFBundleVersion</key>
|
||||||
|
<string>${CURRENT_PROJECT_VERSION}</string>
|
||||||
|
<key>NSPrincipalClass</key>
|
||||||
|
<string></string>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
+5
@@ -0,0 +1,5 @@
|
|||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
@interface PodsDummy_RDPDFReaderView : NSObject
|
||||||
|
@end
|
||||||
|
@implementation PodsDummy_RDPDFReaderView
|
||||||
|
@end
|
||||||
+12
@@ -0,0 +1,12 @@
|
|||||||
|
#ifdef __OBJC__
|
||||||
|
#import <UIKit/UIKit.h>
|
||||||
|
#else
|
||||||
|
#ifndef FOUNDATION_EXPORT
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
#define FOUNDATION_EXPORT extern "C"
|
||||||
|
#else
|
||||||
|
#define FOUNDATION_EXPORT extern
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
+16
@@ -0,0 +1,16 @@
|
|||||||
|
#ifdef __OBJC__
|
||||||
|
#import <UIKit/UIKit.h>
|
||||||
|
#else
|
||||||
|
#ifndef FOUNDATION_EXPORT
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
#define FOUNDATION_EXPORT extern "C"
|
||||||
|
#else
|
||||||
|
#define FOUNDATION_EXPORT extern
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
FOUNDATION_EXPORT double RDPDFReaderViewVersionNumber;
|
||||||
|
FOUNDATION_EXPORT const unsigned char RDPDFReaderViewVersionString[];
|
||||||
|
|
||||||
+16
@@ -0,0 +1,16 @@
|
|||||||
|
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO
|
||||||
|
CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/RDPDFReaderView
|
||||||
|
FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/SnapKit"
|
||||||
|
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||||
|
LIBRARY_SEARCH_PATHS = $(inherited) "${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift
|
||||||
|
OTHER_LDFLAGS = $(inherited) -framework "CoreImage" -framework "PDFKit" -framework "SnapKit" -framework "Vision"
|
||||||
|
OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
|
||||||
|
PODS_BUILD_DIR = ${BUILD_DIR}
|
||||||
|
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||||
|
PODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}
|
||||||
|
PODS_ROOT = ${SRCROOT}
|
||||||
|
PODS_TARGET_SRCROOT = ${PODS_ROOT}/../../Sources/RDPDFReaderView
|
||||||
|
PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates
|
||||||
|
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
|
||||||
|
SKIP_INSTALL = YES
|
||||||
|
USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES
|
||||||
+6
@@ -0,0 +1,6 @@
|
|||||||
|
framework module RDPDFReaderView {
|
||||||
|
umbrella header "RDPDFReaderView-umbrella.h"
|
||||||
|
|
||||||
|
export *
|
||||||
|
module * { export * }
|
||||||
|
}
|
||||||
+16
@@ -0,0 +1,16 @@
|
|||||||
|
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO
|
||||||
|
CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/RDPDFReaderView
|
||||||
|
FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/SnapKit"
|
||||||
|
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||||
|
LIBRARY_SEARCH_PATHS = $(inherited) "${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift
|
||||||
|
OTHER_LDFLAGS = $(inherited) -framework "CoreImage" -framework "PDFKit" -framework "SnapKit" -framework "Vision"
|
||||||
|
OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
|
||||||
|
PODS_BUILD_DIR = ${BUILD_DIR}
|
||||||
|
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||||
|
PODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}
|
||||||
|
PODS_ROOT = ${SRCROOT}
|
||||||
|
PODS_TARGET_SRCROOT = ${PODS_ROOT}/../../Sources/RDPDFReaderView
|
||||||
|
PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates
|
||||||
|
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
|
||||||
|
SKIP_INSTALL = YES
|
||||||
|
USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES
|
||||||
Generated
+24
@@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
|
<string>${PODS_DEVELOPMENT_LANGUAGE}</string>
|
||||||
|
<key>CFBundleIdentifier</key>
|
||||||
|
<string>${PRODUCT_BUNDLE_IDENTIFIER}</string>
|
||||||
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
|
<string>6.0</string>
|
||||||
|
<key>CFBundleName</key>
|
||||||
|
<string>${PRODUCT_NAME}</string>
|
||||||
|
<key>CFBundlePackageType</key>
|
||||||
|
<string>BNDL</string>
|
||||||
|
<key>CFBundleShortVersionString</key>
|
||||||
|
<string>5.7.1</string>
|
||||||
|
<key>CFBundleSignature</key>
|
||||||
|
<string>????</string>
|
||||||
|
<key>CFBundleVersion</key>
|
||||||
|
<string>1</string>
|
||||||
|
<key>NSPrincipalClass</key>
|
||||||
|
<string></string>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
|
<string>${PODS_DEVELOPMENT_LANGUAGE}</string>
|
||||||
|
<key>CFBundleExecutable</key>
|
||||||
|
<string>${EXECUTABLE_NAME}</string>
|
||||||
|
<key>CFBundleIdentifier</key>
|
||||||
|
<string>${PRODUCT_BUNDLE_IDENTIFIER}</string>
|
||||||
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
|
<string>6.0</string>
|
||||||
|
<key>CFBundleName</key>
|
||||||
|
<string>${PRODUCT_NAME}</string>
|
||||||
|
<key>CFBundlePackageType</key>
|
||||||
|
<string>FMWK</string>
|
||||||
|
<key>CFBundleShortVersionString</key>
|
||||||
|
<string>5.7.1</string>
|
||||||
|
<key>CFBundleSignature</key>
|
||||||
|
<string>????</string>
|
||||||
|
<key>CFBundleVersion</key>
|
||||||
|
<string>${CURRENT_PROJECT_VERSION}</string>
|
||||||
|
<key>NSPrincipalClass</key>
|
||||||
|
<string></string>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
@interface PodsDummy_SnapKit : NSObject
|
||||||
|
@end
|
||||||
|
@implementation PodsDummy_SnapKit
|
||||||
|
@end
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
#ifdef __OBJC__
|
||||||
|
#import <UIKit/UIKit.h>
|
||||||
|
#else
|
||||||
|
#ifndef FOUNDATION_EXPORT
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
#define FOUNDATION_EXPORT extern "C"
|
||||||
|
#else
|
||||||
|
#define FOUNDATION_EXPORT extern
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user