{"id":17244538,"url":"https://github.com/fumito-ito/swiftyinappmessaging","last_synced_at":"2025-07-07T21:38:54.922Z","repository":{"id":39967692,"uuid":"329387847","full_name":"fumito-ito/SwiftyInAppMessaging","owner":"fumito-ito","description":"The easiest way to use your customized view and InAppMessaging default view.","archived":false,"fork":false,"pushed_at":"2024-12-10T13:02:33.000Z","size":246,"stargazers_count":7,"open_issues_count":6,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-12T10:47:44.276Z","etag":null,"topics":["firebase","firebase-inappmessaging","ios","swift"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fumito-ito.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-01-13T17:49:19.000Z","updated_at":"2024-12-16T06:56:59.000Z","dependencies_parsed_at":"2024-02-25T10:31:34.465Z","dependency_job_id":"3a9a984c-50ab-46c3-880f-7e4e668d5084","html_url":"https://github.com/fumito-ito/SwiftyInAppMessaging","commit_stats":{"total_commits":90,"total_committers":3,"mean_commits":30.0,"dds":0.09999999999999998,"last_synced_commit":"b3d6ace376496250c3127d2d3e9038952ab86b03"},"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fumito-ito%2FSwiftyInAppMessaging","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fumito-ito%2FSwiftyInAppMessaging/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fumito-ito%2FSwiftyInAppMessaging/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fumito-ito%2FSwiftyInAppMessaging/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fumito-ito","download_url":"https://codeload.github.com/fumito-ito/SwiftyInAppMessaging/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248819403,"owners_count":21166477,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["firebase","firebase-inappmessaging","ios","swift"],"created_at":"2024-10-15T06:18:58.195Z","updated_at":"2025-04-14T04:08:14.326Z","avatar_url":"https://github.com/fumito-ito.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SwiftyInAppMessaging\n\nThe easiest way to coexist your customized view and InAppMessaging default view.  \n\n## Features\n\nThere is only one step to start using SwiftyInAppMessaging.\n\n```swift\nfunc application(_ application: UIApplication, didFinishLaunchWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -\u003e Bool {\n  InAppMessaging.inAppMessaging().messageDisplayComponent = SwiftyInAppMessaging()\n}\n```\n\n## Usage\n\n### Define your message handler\n\n```swift\nstruct InAppMyModalMessageHandler: InAppModalMessageHandler {\n    let messageForDisplay: InAppMessagingModalDisplay\n\n    init(message messageForDisplay: InAppMessagingModalDisplay) {\n        self.messageForDisplay = messageForDisplay\n    }\n\n    func displayMessage(with delegate: InAppMessagingDisplayDelegate) throws {\n        let alert = UIAlertController(title: self.messageForDisplay.title)\n        let ok = UIAlertAction(title: \"OK\", style: .default, handler: { [weak self] _ in\n            guard let messageForDisplay = self?.messageForDisplay else {\n                return\n            }\n            \n            delegate.messageClicked?(messageForDisplay, with: InAppMessagingAction(actionText: \"OK\", actionURL: nil)\n        })\n\n        alert.addAction(ok)\n\n        DispatchQueue.main.async {\n            UIApplication.shared.topViewController?.present(alert, animated: true, completion: nil)\n        }\n    }\n\n    func displayError(_ error: Error) {\n        debugLog(error)\n    }\n}\n```\n\n### Define your message router\n\n```swift\nenum YourOwnMessageRouter {\n    case banner(InAppMessagingBannerDisplay)\n    case card(InAppMessagingCardDisplay)\n    case customModal(InAppMessagingModalDisplay)\n    case imageOnly(InAppMessagingImageOnlyDisplay)\n\n    static func match(for message: InAppMessagingDisplayMessage) -\u003e Self? {\n        switch message.typeWithDisplayMessage {\n        case .banner(let message):\n            return .banner(message: message)\n        case .card(let message):\n            return .card(message: message)\n        case .imageOnly(let message):\n            return .imageOnly(message: message)\n        case .modal(let message):\n            return .customModal(message: message)\n        @unknown default:\n            return nil\n    }\n    \n    var messageHandler: InAppMessageHandler {\n        switch self {\n        case .banner(let message):\n            return message.defaultHandler\n        case .card(let message):\n            return message.defaultHandler\n        case .imageOnly(let message):\n            return message.defaultHandler\n        case .customModal(let message):\n            return InAppMyModalMessageHandler(message: message)\n        }\n    }\n}\n```\n\n### Pass handlers through configuration\n\n```swift\nfunc application(_ application: UIApplication, didFinishLaunchWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -\u003e Bool {\n  InAppMessaging.inAppMessaging().messageDisplayComponent = SwiftyInAppMessaging\u003cYourOwnMessageRouter\u003e()\n}\n```\n\n## Dependencies\n\n- Firebase iOS SDK == `11.0.0`\n\n## Installation\n\n### Carthage\n\nJust add your `Cartfile`\n\n```ruby\ngithub \"fumito-ito/SwiftyInAppMessaging\" ~\u003e 2.0.0\n```\n\nand run `carthage update`\n\n:warning: firebase ios sdk [announces to discontinue carthage support](https://github.com/firebase/firebase-ios-sdk/discussions/7129). if firebase-ios-sdk stops supporting carthage, this library will follow.\n\n### Swift Package Manager\n\nJust add to your `Package.swift` under dependencies\n\n```swift\nlet package = Package(\n    name: \"MyPackage\",\n    products: [...],\n    dependencies: [\n        .package(url: \"https://github.com/fumito-ito/SwiftyInAppMessaging.git\", .upToNextMajor(from: \"2.0.0\"))\n    ]\n)\n```\n\n### Cocoapods\n\nJust add to your `Podfile`\n\n```ruby\npod 'SwiftyInAppMessaging'\n```\n\nand run `pod install`\n\nIf you have errors about `Double-quoted include \"*.h\" in framework header, expected angle-bracketed instead`, you can avoid these errors with following steps.\n\n#### Recommended\n\n1. update your cocoapods `1.10` or later\n1. run `pod install` again\n\n### If you cannot update Cocoapods\n\n1. Click `Pods` project\n1. Click Project's `Build Settings`\n1. Change `Quoted include in Framework Header` to `No`\n\nFor more information, see [a firebase-ios-sdk issue](https://github.com/firebase/firebase-ios-sdk/issues/5987).\n\n### License\n\nSwiftyInAppMessaging is available under the Apache License 2.0. See the LICENSE file for more detail.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffumito-ito%2Fswiftyinappmessaging","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffumito-ito%2Fswiftyinappmessaging","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffumito-ito%2Fswiftyinappmessaging/lists"}