doc: 更新 README

This commit is contained in:
icyleaf
2020-01-14 15:11:53 +08:00
parent 15f4759fe5
commit 3ed73d6016
3 changed files with 49 additions and 12 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
Copyright (c) 2020 icyleaf <icyleaf.cn@gmail.com>
Copyright (c) 2020-present icyleaf <icyleaf.cn@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
+41 -8
View File
@@ -5,19 +5,52 @@
[![License](https://img.shields.io/cocoapods/l/Zealot.svg?style=flat)](https://cocoapods.org/pods/Zealot)
[![Platform](https://img.shields.io/cocoapods/p/Zealot.svg?style=flat)](https://cocoapods.org/pods/Zealot)
## Example
## 安装
To run the example project, clone the repo, and run `pod install` from the Example directory first.
### Cocoapods
## Requirements
使用 [Cocoapods](https://cocoapods.org) 安装 Zealot 需要把它加到 `PodFile`:
## Installation
Zealot is available through [CocoaPods](https://cocoapods.org). To install
it, simply add the following line to your Podfile:
> 未达到上线标准前暂不上 Cocoapods Specs
```ruby
pod 'Zealot'
pod 'Zealot', :git => 'https://github.com/getzealot/zealot-ios.git', :branch => 'master'
```
保存后开始安装:
```sh
pod install
```
## 使用
1. 在 AppDelegate 文件t引入 Zealot 框架头:
```swift
// Swift
import Zealot
```
```objective-c
// Objective-C
#import <Zealot/Zealot-Swift.h>
```
2. 接着在上面文件的 `application:didFinishLaunchingWithOptions:` 方法追加启动代码:
```swift
// Swift
let zealot = Zealot(endpoint: "http://zealot.test",
channelKey: "...")
zealot.checkVersion()
```
```objective-c
// Objective-C
Zealot *zealot = [[Zealot alloc] initWithEndpoint:@"http://zealot.test"
channelKey:@"..."];
[zealot checkVersion];
```
## Author
+7 -3
View File
@@ -11,9 +11,8 @@ import UIKit
public final class Zealot: NSObject {
public let defaultEnvironment: String = "default"
public var enviroment: String
private var endpoint: String
private var channelKeys: [String: String] = [:]
public var endpoint: String
public var channelKeys: [String: String] = [:]
public init(endpoint: String, channelKey: String) {
self.endpoint = endpoint
@@ -32,6 +31,11 @@ public final class Zealot: NSObject {
// MARK: - Public methods
public extension Zealot {
func setChannelKey(channelKey: String, environment: String) {
self.channelKeys[environment] = channelKey
}
func checkVersion() {
let client = try! Client(endpoint: endpoint, channelKey: useChannelKey())
client.checkVersion { (result) in