|
| 1 | +# Mirrorfly Sample App |
| 2 | + |
| 3 | +## Overview |
| 4 | +Our sample app provides basic UI integrated with latest Mirrorfly SDK where you can customize and build your own app easily. |
| 5 | + |
| 6 | +## Before getting started |
| 7 | + |
| 8 | +This section shows you the prerequisites you need for testing **Mirrorfly Sample App**. |
| 9 | + |
| 10 | +### Requirements |
| 11 | +The minimum requirements to run the Sample App: |
| 12 | + |
| 13 | +```groovy |
| 14 | +- Xcode 15 or later |
| 15 | +- iOS 13.0 or later |
| 16 | +- Swift 5.0 or later |
| 17 | +``` |
| 18 | + |
| 19 | +## Getting started |
| 20 | + |
| 21 | +This section gives you information you need to get started with MirrorFly UIKit for iOS. |
| 22 | + |
| 23 | +**Try the sample app** |
| 24 | + |
| 25 | +Our sample app has all the core features of MirrorFly SDK with an integrated UI. You can download the source code from our GitHub repository to get an idea of what you can build with the actual UI before building your own project. |
| 26 | + |
| 27 | +**Step 1:** Install SDK for iOS |
| 28 | + |
| 29 | +SDK for iOS can be installed through <a href="https://cocoapods.org/" target="_self">CocoaPods</a> |
| 30 | + |
| 31 | +**- CocoaPods** |
| 32 | + |
| 33 | +1. Add `MirrorflySDK` into your `Podfile` in Xcode as below: |
| 34 | + |
| 35 | +```gradle |
| 36 | +platform :ios, '13.0' |
| 37 | +use_frameworks! |
| 38 | +
|
| 39 | +target YOUR_PROJECT_TARGET do |
| 40 | + pod 'MirrorflySDK' |
| 41 | +end |
| 42 | + ``` |
| 43 | + |
| 44 | +2. Add the below given pod hook code block at the end of the pod file and thus, finally install the pods. |
| 45 | + |
| 46 | +```gradle |
| 47 | +post_install do |installer| |
| 48 | + installer.pods_project.targets.each do |target| |
| 49 | + target.build_configurations.each do |config| |
| 50 | + config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0' |
| 51 | + config.build_settings['ENABLE_BITCODE'] = 'NO' |
| 52 | + config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'No' |
| 53 | + config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64' |
| 54 | + config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES' |
| 55 | + config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO' |
| 56 | + end |
| 57 | + end |
| 58 | +end |
| 59 | +
|
| 60 | +``` |
| 61 | + |
| 62 | +3. Install the `MirrorflySDK` framework through `CocoaPods`. |
| 63 | + |
| 64 | +```gradle |
| 65 | +$ pod install |
| 66 | +``` |
| 67 | +4. Update the `MirrorflySDK` framework through `CocoaPods`. |
| 68 | + |
| 69 | +```gradle |
| 70 | +$ pod update |
| 71 | +``` |
| 72 | + |
| 73 | +**Step 2:** Get `GoogleSerive-Info Plist` API Key and Adding to your `MirrorFlyUIKit-Info Plist` |
| 74 | +```gradle |
| 75 | +<key>googleApiKey</key> |
| 76 | +<string>****************</string> |
| 77 | +<key>googleApiKeyStaticMap</key> |
| 78 | +<string>****************</string> |
| 79 | +<key>googleApiKey_Translation</key> |
| 80 | +<string>****************</string> |
| 81 | +``` |
| 82 | + |
| 83 | +**Step 3:** To log in and run the app, you need to add the LICENCSE key in the app. To generate the license key, you need to sign up in the <a href="https://console.mirrorfly.com/" target="_self">MirrorFly console</a> , and you can get it from there. |
| 84 | + |
| 85 | +**Step 4:** Initialize with License Key. |
| 86 | + |
| 87 | +You can copy the license key from the Overview section in the Console dashboard and paste it in the Appdelegate like below. |
| 88 | + ```gradle |
| 89 | +let LICENSE_KEY = "xxxxxxxxxxxxxxxxxxxxxx" //"YOUR_LICENSE_KEY" |
| 90 | + ``` |
| 91 | + |
| 92 | +## Initialize ChatSDK |
| 93 | + |
| 94 | +Add the following import statement below before accessing SDK anywhere in your project. |
| 95 | + |
| 96 | +```gradle |
| 97 | +import MirrorFlySDK |
| 98 | +``` |
| 99 | +In `Appdelegate` didFinishLaunchingWithOptions function add SDK initialize method with valid Licensekey |
| 100 | + |
| 101 | +```gradle |
| 102 | + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { |
| 103 | + ChatManager.initializeSDK(licenseKey: LICENSE_KEY) { isSuccess, error, data in |
| 104 | +
|
| 105 | + } |
| 106 | + } |
| 107 | +``` |
| 108 | + |
| 109 | +In `NotificationService` didReceive function add SDK initialize method with valid Licensekey |
| 110 | + |
| 111 | +```gradle |
| 112 | +override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) { |
| 113 | + ChatManager.initializeSDK(licenseKey: LICENSE_KEY) { isSuccess, error, data in |
| 114 | +
|
| 115 | + } |
| 116 | +} |
| 117 | +``` |
| 118 | +In `ShareKitViewModel` initialize function add SDK initialize method with valid Licensekey |
| 119 | + |
| 120 | +```gradle |
| 121 | + func initialize() { |
| 122 | + ChatManager.initializeSDK(licenseKey: LICENSE_KEY) { isSuccess, error, data in |
| 123 | +
|
| 124 | + } |
| 125 | +} |
| 126 | +``` |
| 127 | + |
| 128 | +Feel free to proceed with running the app once you've gone through all the provided information. Please check our official docs <a href="https://www.mirrorfly.com/docs/" target="_self">MirrorFly Docs</a> to know more about MirrorFlySDK. |
| 129 | + |
0 commit comments