You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
MyQRCode/docs/HISTORY_FEATURE_README.md

77 lines
2.1 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# 历史记录功能实现说明
## 🎯 功能概述
`MyQrCode` 应用添加了完整的历史记录功能,支持本地数据保存,包含扫描和手动创建两种数据来源,涵盖条形码和二维码的多种类型。
## 🔧 主要功能特性
### 1. **数据来源支持**
- **扫描获得**: 通过相机扫描获得的二维码/条形码
- **手动创建**: 用户手动输入的二维码/条形码内容
### 2. **数据类型支持**
#### 条形码类型
- `EAN-13`: 13位欧洲商品编码
- `EAN-8`: 8位欧洲商品编码
- `UPC-E`: 压缩版通用产品代码
- `Code 39`: 39码
- `Code 128`: 128码
- `PDF417`: PDF417码
#### 二维码类型
- `WiFi`: WiFi网络配置
- `Email`: 电子邮件
- `URL`: 网址链接
- `Phone`: 电话号码
- `SMS`: 短信
- `vCard`: 电子名片
- `MeCard`: MeCard格式
- `Text`: 纯文本
- `Location`: 地理位置
- `Calendar`: 日历事件
- `Instagram`: Instagram链接
- `Facebook`: Facebook链接
- `Spotify`: Spotify音乐
- `X`: X链接
- `WhatsApp`: WhatsApp消息
- `Viber`: Viber消息
- `Snapchat`: Snapchat链接
- `TikTok`: TikTok链接
### 3. **数据字段**
- **内容**: 二维码/条形码的实际内容
- **数据类型**: 条形码或二维码
- **具体类型**: 具体的编码格式
- **数据来源**: 扫描获得或手动创建
- **创建时间**: 记录创建的时间戳
- **收藏状态**: 是否标记为收藏
## 🐛 兼容性问题修复
### 问题描述
`CreateCodeView.swift` 中使用了 iOS 16.0+ 的 API导致在 iOS 15.6 部署目标下编译失败:
```
'init(_:text:axis:)' is only available in iOS 16.0 or newer
'lineLimit' is only available in iOS 16.0 or newer
```
### 修复方案
将 iOS 16.0+ 的 API 替换为 iOS 15.6 兼容的替代方案:
```swift
// ❌ iOS 16.0+ 的写法
TextField("请输入内容", text: $content, axis: .vertical)
.lineLimit(3...6)
// ✅ iOS 15.6 兼容的写法
TextField("请输入内容", text: $content)
.frame(minHeight: 80)
```
### 修复后的效果
- 保持了多行文本输入的功能
- 通过 `minHeight: 80` 提供足够的输入空间
- 确保在 iOS 15.6 及以上版本正常工作