Hubkit
示例
示例应用程序是查看 Hubkit 的最佳方式。只需打开 Hubkit.xcodeproj
并运行 Example
脚本。
安装
CocoaPods
Hubkit 可通过 CocoaPods 获取。要安装它,只需在 Podfile 中添加以下行:
pod 'Hubkit'
Carthage
Carthage 是一个去中心化的依赖管理器,它为您构建依赖项并提供二进制框架。
要使用 Carthage 将 Hubkit 集成到您的 Xcode 项目中,请在您的 Cartfile
中指定它。
github "Move Upwards/Hubkit"
运行 carthage update
构建框架,并将构建的 Hubkit.framework
拖到您的 Xcode 项目中。
在您的应用目标“构建阶段”设置选项卡中,点击“+”图标,选择“新运行脚本阶段”,并将框架路径添加到如 Carthage 入门步骤 4、5 和 6 中所述。
Swift Package Manager
若使用 Apple 的 Swift 包管理器 进行集成,请将以下内容添加到您的 Package.swift
中作为依赖项。
dependencies: [
.package(url: "[email protected]:MoveUpwards/HubKit.git.git", from: "1.0.0")
]
手动
如果您不愿意使用上述任何依赖管理器,可以手动将 Hubkit 集成到项目中。只需将 源
文件夹拖入您的 Xcode 项目中即可。
使用方法
import Foundation
import HubKit
final class HubKitService {
var account: HKAccount?
init() {
// Set your config and api key
Hubkit.default
.set(project: "YOUR-PROJECT-IDENTIFIER")
.set(config: Config(baseURL: plateform.baseUrl))
.set(apiKey: HKApiKeyToken(apiKey: "PROJECT-API-KEY"))
// Check the current user
Hubkit.me(success: { [weak self] account in
self?.account = account
}, failure: { error in
print(error.localizedDescription)
})
}
}
贡献
非常欢迎贡献
许可
Hubkit
Copyright (c) 2019 Move Upwards [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.