Installation
Courier supports both Cocoapods and SPM for dependency manager. It is separated into 5 modules:
CourierCore: Contains public APIs such as protocols and data types for Courier. Other modules have basic dependency on this module. You can use this module if you want to implement the interface in your project without adding Courier implementation in your project.CourierMQTT: Contains implementation ofCourierClientandCourierSessionusingMQTT. This module has dependency toMQTTClientGJ.MQTTClientGJ: A forked version of open source library MQTT-Client-Framework. It add several features such as connect and inactivity timeout. It also fixes race condition crashes inMQTTSocketEncoderandConnackstatus 5 not completing the decode beforeMQTTTransportDidClosegot invoked bugs.CourierProtobuf: Contains implementation ofProtobufMessageAdapterusingProtofobuf. It has dependency toSwiftProtobuflibrary, this isoptionaland can be used if you are using protobuf for data serialization.CourierMQTTChuck: Can be ussed to inspects all the outgoing or incoming packets for an underlying MQTT connection. It intercepts all the packets, persisting them and providing a UI for accessing all the MQTT packets sent or received. It also provides multiple other features like search, share, and clear data. UsesSwiftUIunder the hood.
Cocoapods
// Podfile
target 'Example-App' do
use_frameworks!
pod 'CourierCore'
pod 'CourierMQTT'
pod 'CourierProtobuf' #optional
pod 'CourierMQTTChuck' #optional
end
Swift Package Manager (SPM)
Simply add the package dependency to your Package.swift and depend on CourierCore and CourierMQTT in the necessary targets:
dependencies: [
.package(url: "https://github.com/gojek/courier-iOS", branch: "main")
]