Tomorrow
特性
ℹ️ 将 ISO8601 字符串解析为日期- 自动处理带和不带毫秒的格式
- 在新系统中使用 ISO8601DateFormatter(iOS 11.2.1+,macOS 10.13+,tvOS 11.0+,watchOS 4.0+)
示例
// "2020-11-01T21:10:56Z"
// "2020-11-01T21:10:56.715+01:00"
// "2020-11-01T21:10:56.22+02:00"
let date = Date.fromISO("2020-11-01T21:10:56.22+02:00")
安装
CocoaPods
Tomorrow 通过 CocoaPods 提供。要安装它,只需将以下行添加到 Podfile 中
pod 'Tomorrow'
Carthage
Carthage 是一个去中心化的依赖管理器,它可以构建你的依赖并提供二进制框架。
要使用 Carthage 将 Tomorrow 集成到你的 Xcode 项目中,请在你的 Cartfile
中指定它。
github "lukszar/Tomorrow"
运行 carthage update
构建框架,并将构建好的 Tomorrow.framework
拖拽到你的 Xcode 项目中。
在你的应用程序目标的“构建 phases”设置选项卡中,点击“+”图标,选择“New Run Script Phase”并添加到《Carthage Getting started Step 4, 5 and 6》中提到的框架路径。
Swift 包管理器
要使用 Apple 的 Swift 包管理器 集成,请将以下内容作为依赖项添加到你的 Package.swift
文件中。
dependencies: [
.package(url: "https://github.com/lukszar/Tomorrow.git", from: "1.0.0")
]
或者导航到你的 Xcode 项目,选择 Swift Packages
,点击 +
图标搜索 Tomorrow
。
手动集成
如果你不想使用上述任何依赖管理器,你可以手动将 Tomorrow 集成到你的项目中。只需将 Sources
文件夹拖拽到你的 Xcode 项目中即可。
进一步开发
这个简单的工具被创建出来是为了检查 SwiftKit 的运行情况。我计划不久后扩展此工具以添加新功能。敬请期待!
贡献
非常欢迎贡献
许可证
Tomorrow
Copyright (c) 2020 Mobilee [email protected]
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.