Swiftpack.co - fumito-ito/SwiftyInAppMessaging as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by fumito-ito.
fumito-ito/SwiftyInAppMessaging 0.6.0
The easiest way to use your customized view and InAppMessaging default view.
⭐️ 3
🕓 13 weeks ago
iOS macOS tvOS
.package(url: "https://github.com/fumito-ito/SwiftyInAppMessaging.git", from: "0.6.0")


The easiest way to coexist your customized view and InAppMessaging default view.


There is only one step to start using SwiftyInAppMessaging.

func application(_ application: UIApplication, didFinishLaunchWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
  InAppMessaging.inAppMessaging().messageDisplayComponent = SwiftyInAppMessaging()


Define your message handler

struct InAppMyModalMessageHandler: InAppModalMessageHandler {
    let messageForDisplay: InAppMessagingModalDisplay
    let displayDelegate: InAppMessagingDisplayDelegate

    init?(message messageForDisplay: InAppMessagingDisplayMessage, displayDelegate: InAppMessagingDisplayDelegate) {
        guard let messageForDisplay = messageForDisplay as? InAppMessagingModalDisplay else {
            return nil

        self.messageForDisplay = messageForDisplay
        self.displayDelegate = displayDelegate

    static func canHandleMessage(message messageForDisplay: InAppMessagingDisplayMessage, displayDelegate: InAppMessagingDisplayDelegate) -> Bool {
        return messageForDisplay is InAppMessagingModalDisplay

    func displayMessage() {
        let alert = UIAlertController(title: self.messageForDisplay.title)
        let ok = UIAlertAction(title: "OK", style: .default, handler: { _ in })


        DispatchQueue.main.async {
            UIApplication.shared.topViewController?.present(alert, animated: true, completion: nil)

    func displayError(_ error: Error) {

Define your configuration

struct MyInAppMessagingConfiguration: SwiftyInAppMessagingConfiguration {
    let useDefaultHandlersIfNeeded: Bool = true
    let messageHandlers: [InAppMessageHandler.Type] = [

Pass handlers through configuration

func application(_ application: UIApplication, didFinishLaunchWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
  let config = MyInAppMessagingConfiguration()
  InAppMessaging.inAppMessaging().messageDisplayComponent = SwiftyInAppMessaging(with: config)


  • Firebase iOS SDK == 9.0.0



Just add your Cartfile

github "fumito-ito/SwiftyInAppMessaging" ~> 0.5.1

and run carthage update

:warning: firebase ios sdk announces to discontinue carthage support. if firebase-ios-sdk stops supporting carthage, this library will follow.

Swift Package Manager

Just add to your Package.swift under dependencies

let package = Package(
    name: "MyPackage",
    products: [...],
    dependencies: [
        .package(url: "https://github.com/fumito-ito/SwiftyInAppMessaging.git", .upToNextMajor(from: "0.5.1"))


Just add to your Podfile

pod 'SwiftyInAppMessaging'

and run pod install

If you have errors about Double-quoted include "*.h" in framework header, expected angle-bracketed instead, you can avoid these errors with following steps.


  1. update your cocoapods 1.10 or later
  2. run pod install again

If you cannot update Cocoapods

  1. Click Pods project
  2. Click Project's Build Settings
  3. Change Quoted include in Framework Header to No

For more information, see a firebase-ios-sdk issue.


SwiftyInAppMessaging is available under the Apache License 2.0. See the LICENSE file for more detail.


Stars: 3
Last commit: 3 days ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Release Notes

13 weeks ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics