ProntoSDK 4.0.3

ProntoSDK 4.0.3

Bas van Kuijck 维护。



ProntoSDK 4.0.3

  • Bas van Kuijck

Pronto iOS SDK


官方 Pronto iOS SDK


加入我们的 Slack 频道   |   在 Beerpay 上支持我们


安装

Cocoapods

请在您的 Podfile 中添加以下内容

pod 'ProntoSDK'

有效的子规范

  • ProntoSDK/Authentication
  • ProntoSDK/Notifications
  • ProntoSDK/Collections
  • ProntoSDK/AppUpdateCheck
  • ProntoSDK/Localization
  • ProntoSDK/RemoteConfig

然后运行

pod install

Carthage

请在您的 Cartfile 中添加以下内容

github "Pronto-am/MobileCMS-iOS-SDK"

然后运行

carthage update

SwiftPM

将以下依赖关系添加到您的 Package.swift

 .package(url: "https://github.com/Pronto-am/MobileCMS-iOS-SDK", .upToNextMajor(from: "2.0.0"))

Accio

将以下依赖关系添加到您的 Package.swift

 .package(url: "https://github.com/Pronto-am/MobileCMS-iOS-SDK", .upToNextMajor(from: "2.0.0"))

然后运行

accio install

开发

打开 ProntoSDK.xcodeproj 开始开发。

实现

核心

AppDelegate.swift

import ProntoSDK

func application(_ application: UIApplication,
                 didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

    let config = ProntoConfig()
    
    // Setup the API client credentials
    config.clientID = <#CLIENT_ID#>
    config.clientSecret = <#CLIENT_SECRET#>
    config.encryptionKey = <#ENCRYPTION_KEY#>    
    config.domain = "mypronto.site.com"
    config.firebaseDomain = "myprontoproject.firebaseio.com"
    
    // Activate each plugin your project uses
    config.plugins = [ .notifications, .authentication, .collections, .localization, .updateChecker ]
    
    // Disable logging for non-debug builds
    #if DEBUG
        config.logger = Logger() // Should conform to `Cobalt.Logger` protocol
    #endif
    
    ProntoSDK.configure(config)
    
    // Do the rest of the implementation
    
    return true

通知插件

📯 阅读通知文档

认证插件

🔐 阅读认证文档

收藏插件

🗂 阅读收藏插件文档

更新检查插件

🌟 阅读更新检查插件文档

本地化

🇪🇺 阅读本地化文档

远程配置

⚙️ 阅读远程配置文档

RxSwift

ProntoSDK使用的几乎所有异步函数都内部使用RxSwift

import RxSwift
import RxCocoa

let single = ProntoCollection<Location>().list() // = Single<[Location]>
single.subscribe(onSuccess: { locations in 
    // ...
}, onError: { error in 
    print("Error fetching locations: \(error)")
}).disposed(by: disposeBag)

参考资料