Getting Started
Requirements
Installation
CocoaPods
CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:
$ gem install cocoapods
To integrate EZPush into your Xcode project using CocoaPods, specify it in your Podfile:
source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!
target '<Your Target Name>' do
platform :ios, '13.0'
pod 'EZPush'
end
Then, run the following command:
$ pod install
Swift Package Manager
You can use the Swift Package Manager to install EZPush into your Xcode project. Follow these steps:
- Open your project in Xcode.
- Select "File" -> "Swift Packages" -> "Add Package Dependencies..."
- Enter the repository URL:
https://github.com/ez-push/ios - Select the version you wish to use and click "Add Package".
Usage
To utilize EZPush, import the module into your Swift file:
import EZPush
Requesting Permission
EZPush.current.requestForPushNotificationPermission([.alert, .badge, .sound]) { _, _ in }
Configure EZPush
let config = EZPushConfiguration(licenseKey: "YOUR_LICENSE_KEY", showDebugInfo: true, groupName: "YOUR_GROUP_NAME")
EZPush.current.configure(config, startPeriodicSync: Bool)
EZPush.current.initialize(pushNotificationToken: "PUSH_NOTIFICATION_TOKEN") { error in }
EZPushDelegate
EZPush provides a delegate that provides two handler functions for processing a deeplink and custom data. TODO: function parameter documentation
extension TagViewModel: EZPushDelegate {
func handleCustomData(customData: CustomData, actionIdentifier: String) {
self.logger.info("Received Notifications contains the customData: \(String(describing: customData))")
}
func handleDeeplink(deeplink: String, actionIdentifier: String) {
self.logger.info("Received Notifications contains the deeplink: \(deeplink)")
}
}