Merge pull request #44 from fumito-ito/version/bump version bump
Merge pull request #44 from fumito-ito/version/bump
version bump
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() }
struct InAppMyModalMessageHandler: InAppModalMessageHandler { let messageForDisplay: InAppMessagingModalDisplay init(message messageForDisplay: InAppMessagingModalDisplay) { self.messageForDisplay = messageForDisplay } func displayMessage(with delegate: InAppMessagingDisplayDelegate) throws { let alert = UIAlertController(title: self.messageForDisplay.title) let ok = UIAlertAction(title: "OK", style: .default, handler: { [weak self] _ in guard let messageForDisplay = self?.messageForDisplay else { return } delegate.messageClicked?(messageForDisplay, with: InAppMessagingAction(actionText: "OK", actionURL: nil) }) alert.addAction(ok) DispatchQueue.main.async { UIApplication.shared.topViewController?.present(alert, animated: true, completion: nil) } } func displayError(_ error: Error) { debugLog(error) } }
enum YourOwnMessageRouter { case banner(InAppMessagingBannerDisplay) case card(InAppMessagingCardDisplay) case customModal(InAppMessagingModalDisplay) case imageOnly(InAppMessagingImageOnlyDisplay) static func match(for message: InAppMessagingDisplayMessage) -> Self? { switch message.typeWithDisplayMessage { case .banner(let message): return .banner(message: message) case .card(let message): return .card(message: message) case .imageOnly(let message): return .imageOnly(message: message) case .modal(let message): return .customModal(message: message) @unknown default: return nil } var messageHandler: InAppMessageHandler { switch self { case .banner(let message): return message.defaultHandler case .card(let message): return message.defaultHandler case .imageOnly(let message): return message.defaultHandler case .customModal(let message): return InAppMyModalMessageHandler(message: message) } } }
func application(_ application: UIApplication, didFinishLaunchWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { InAppMessaging.inAppMessaging().messageDisplayComponent = SwiftyInAppMessaging<YourOwnMessageRouter>() }
10.0.0
Just add your Cartfile
Cartfile
github "fumito-ito/SwiftyInAppMessaging" ~> 2.0.0
and run carthage update
carthage update
firebase ios sdk announces to discontinue carthage support. if firebase-ios-sdk stops supporting carthage, this library will follow.
Just add to your Package.swift under dependencies
Package.swift
let package = Package( name: "MyPackage", products: [...], dependencies: [ .package(url: "https://github.com/fumito-ito/SwiftyInAppMessaging.git", .upToNextMajor(from: "2.0.0")) ] )
Just add to your Podfile
Podfile
pod 'SwiftyInAppMessaging'
and run pod install
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.
Double-quoted include "*.h" in framework header, expected angle-bracketed instead
1.10
Pods
Build Settings
Quoted include in Framework Header
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.
©Copyright 2023 CCF 开源发展委员会 Powered by Trustie& IntelliDE 京ICP备13000930号
SwiftyInAppMessaging
The easiest way to coexist your customized view and InAppMessaging default view.
Features
There is only one step to start using SwiftyInAppMessaging.
Usage
Define your message handler
Define your message router
Pass handlers through configuration
Dependencies
10.0.0
Installation
Carthage
Just add your
Cartfile
and run
carthage update
Swift Package Manager
Just add to your
Package.swift
under dependenciesCocoapods
Just add to your
Podfile
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.Recommended
1.10
or laterpod install
againIf you cannot update Cocoapods
Pods
projectBuild Settings
Quoted include in Framework Header
toNo
For more information, see a firebase-ios-sdk issue.
License
SwiftyInAppMessaging is available under the Apache License 2.0. See the LICENSE file for more detail.