Latest 0.3.2
Homepage https://github.com/miup/Tsuchi
License MIT
Platforms ios 11.0
Dependencies Firebase/Core, Firebase/Messaging, Result
Authors

Tsuchi is awesome Firebase Cloud Messaging wrapper.
You can handle FCM easily and type-safely.

CI Status
Version
License
Platform

Usage

Register/Unregister Notification

User.login {
    // register remote notification (show dialog if user not determined about notification permission.)
    Tsuchi.shared.register { authorized in
        //...
    }
}

User.logout {
    Tsuchi.shared.unregister { authorized in
        //...
    }
}

Subscribe Push Notification

    1. Create Payload Model (must conform to PushNotificationPayload)
struct FCMNotificationPayload: PushNotificationPayload {
    let eventName: String?
    let eventType: EventType?
    var aps: APS?
}
    1. call Tsuchi.subscibe(_:completion)
Tsuchi.shared.subscribe(FCMNotificationPayload.self) { result in
    switch result {
    case .success(let (notification, mode)):
        print(notification.name, mode)
    case .failure(let error):
        print(error)
    }
}

Subscribe/UnSubscribe Topic

public enum AppTopic: String, TopicType {
    case owner
    case member
}

// Subscribe topic
Tsuchi.shared.subscribe(toTopic: AppTopic.owner)

// Unsubscribe topic
Tsuchi.shared.unsubscribe(fromTopic: AppTopic.owner)

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

Tsuchi is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'Tsuchi'

Author

miup, [email protected]

License

Tsuchi is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "Tsuchi",
    "version": "0.3.2",
    "summary": "Tsuchi is a Firebase Cloud Messaging wrapper.",
    "description": "Tsuchi is a Firebase Cloud Messaging wrapper.nYou can define type safe Notification object, and handle it.",
    "homepage": "https://github.com/miup/Tsuchi",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "miup": "[email protected]"
    },
    "source": {
        "git": "https://github.com/miup/Tsuchi.git",
        "tag": "0.3.2"
    },
    "platforms": {
        "ios": "11.0"
    },
    "source_files": "Tsuchi/Classes/**/*",
    "static_framework": true,
    "dependencies": {
        "Firebase/Core": [
            "~>5.0"
        ],
        "Firebase/Messaging": [
            "~>5.0"
        ],
        "Result": []
    }
}

Pin It on Pinterest

Share This