{"id":13764503,"url":"https://github.com/webex/spark-ios-sdk","last_synced_at":"2025-04-13T12:09:12.915Z","repository":{"id":56922183,"uuid":"58420649","full_name":"webex/spark-ios-sdk","owner":"webex","description":"DEPRECATE. Check our newer iOS SDK","archived":false,"fork":false,"pushed_at":"2019-04-04T22:53:36.000Z","size":386108,"stargazers_count":35,"open_issues_count":2,"forks_count":15,"subscribers_count":29,"default_branch":"master","last_synced_at":"2025-03-27T03:11:31.295Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://github.com/webex/webex-ios-sdk","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/webex.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-05-10T01:41:13.000Z","updated_at":"2023-05-26T02:37:28.000Z","dependencies_parsed_at":"2022-08-21T04:50:21.295Z","dependency_job_id":null,"html_url":"https://github.com/webex/spark-ios-sdk","commit_stats":null,"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webex%2Fspark-ios-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webex%2Fspark-ios-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webex%2Fspark-ios-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webex%2Fspark-ios-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/webex","download_url":"https://codeload.github.com/webex/spark-ios-sdk/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248252695,"owners_count":21072701,"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":[],"created_at":"2024-08-03T16:00:21.764Z","updated_at":"2025-04-13T12:09:12.889Z","avatar_url":"https://github.com/webex.png","language":"Swift","readme":"DEPRECATED. Check our newer iOS SDK https://github.com/webex/webex-ios-sdk\n\n# Cisco Spark iOS SDK\n\n[![CocoaPods](https://img.shields.io/cocoapods/v/SparkSDK.svg)](https://cocoapods.org/pods/SparkSDK)\n[![Travis CI](https://travis-ci.org/webex/spark-ios-sdk.svg?branch=master)](https://travis-ci.org/webex/spark-ios-sdk)\n[![license](https://img.shields.io/github/license/webex/spark-ios-sdk.svg)](https://github.com/ciscospark/spark-ios-sdk/blob/master/LICENSE)\n\nThe Cisco Spark iOS SDK makes it easy to integrate secure and convenient Cisco Spark messaging and calling features in your iOS apps.\n\nThis SDK is written in [Swift 4](https://developer.apple.com/swift) and requires **iOS 10** or later.\n\n## Table of Contents\n\n- [Install](#install)\n- [Usage](#usage)\n- [Upgrade 1.3.1 to 1.4.0](#upgrade-sdk-131-to-140-breaking-changes)\n- [License](#license)\n\n## Install\n\nAssuming you already have an Xcode project, e.g. _MySparkApp_, for your iOS app, here are the steps to integrate the Spark iOS SDK into your Xcode project using [CocoaPods](http://cocoapods.org):\n\n1. Install CocoaPods:\n\n    ```bash\n    gem install cocoapods\n    ```\n\n2. Setup CocoaPods:\n\n    ```bash\n    pod setup\n    ```\n\n3. Create a new file, `Podfile`, with following content in your _MySparkApp_ project directory:\n\n    ```ruby\n    source 'https://github.com/CocoaPods/Specs.git'\n    \n    use_frameworks!\n\n    target 'MySparkApp' do\n      platform :ios, '10.0'\n      pod 'SparkSDK'\n    end\n    \n    target 'MySparkAppBroadcastExtension' do\n        platform :ios, '11.2'\n        pod 'SparkBroadcastExtensionKit'\n    end\n    ```\n\n4. Install the Spark iOS SDK from your _MySparkApp_ project directory:\n\n    ```bash\n    pod install\n    ```\n\n## Usage\n\nTo use the SDK, you will need Cisco Spark integration credentials. If you do not already have a Cisco Spark account, visit [Spark for Developers](https://developer.ciscospark.com/) to create your account and [register your integration](https://developer.ciscospark.com/authentication.html#registering-your-integration). Your app will need to authenticate users via an [OAuth](https://oauth.net/) grant flow for existing Cisco Spark users or a [JSON Web Token](https://jwt.io/) for guest users without a Cisco Spark account.\n\nSee the [iOS SDK area](https://developer.ciscospark.com/sdk-for-ios.html) of the Spark for Developers site for more information about this SDK.\n\n### Example\n\nHere are some examples of how to use the iOS SDK in your app.\n\n1. Create the Spark instance using Spark ID authentication ([OAuth](https://oauth.net/)-based):\n\n    ```swift\n    let clientId = \"$YOUR_CLIENT_ID\"\n    let clientSecret = \"$YOUR_CLIENT_SECRET\"\n    let scope = \"spark:all\"\n    let redirectUri = \"Sparkdemoapp://response\"\n\n    let authenticator = OAuthAuthenticator(clientId: clientId, clientSecret: clientSecret, scope: scope, redirectUri: redirectUri)\n    let spark = Spark(authenticator: authenticator)\n\n    if !authenticator.authorized {\n        authenticator.authorize(parentViewController: self) { success in\n            if !success {\n                print(\"User not authorized\")\n            }\n        }\n    }\n    ```\n\n2. Create the Spark instance with Guest ID authentication ([JWT](https://jwt.io/)-based):\n\n    ```swift\n    let authenticator = JWTAuthenticator()\n    let spark = Spark(authenticator: authenticator)\n\n    if !authenticator.authorized {\n        authenticator.authorizedWith(jwt: myJwt)\n    }\n    ```\n\n3. Register the device to send and receive calls:\n\n    ```swift\n    spark.phone.register() { error in\n        if let error = error {\n            // Device not registered, and calls will not be sent or received\n        } else {\n            // Device registered\n        }\n    }\n    ```\n\n4. Use Spark service:\n\n    ```swift\n    spark.rooms.create(title: \"Hello World\") { response in\n        switch response.result {\n        case .success(let room):\n            // ...\n        case .failure(let error):\n            // ...\n        }\n    }\n\n    // ...\n\n    spark.memberships.create(roomId: roomId, personEmail: email) { response in\n        switch response.result {\n        case .success(let membership):\n            // ...\n        case .failure(let error):\n            // ...\n        }\n    }\n    \n    ```\n\n5. Make an outgoing call:\n\n    ```swift\n    spark.phone.dial(\"coworker@acm.com\", option: MediaOption.audioVideo(local: ..., remote: ...)) { ret in\n        switch ret {\n        case .success(let call):\n            call.onConnected = {\n                // ...\n            }\n            call.onDisconnected = { reason in\n                // ...\n            }\n        case .failure(let error):\n            // failure\n        }\n    }\n    ```\n\n6. Receive a call:\n\n    ```swift\n    spark.phone.onIncoming = { call in\n        call.answer(option: MediaOption.audioVideo(local: ..., remote: ...)) { error in\n        if let error = error {\n            // success\n        }\n        else {\n            // failure\n        }\n    }\n    ```\n\n7. Make an room call:\n\n    ```swift\n    spark.phone.dial(roomId, option: MediaOption.audioVideo(local: ..., remote: ...)) { ret in\n        switch ret {\n        case .success(let call):\n            call.onConnected = {\n                // ...\n            }\n            call.onDisconnected = { reason in\n                // ...\n            }\n            call.onCallMembershipChanged = { changed in\n                switch changed {\n                case .joined(let membership):\n                    //\n                case .left(let membership):\n                    //\n                default:\n                    //\n                }                \n            }            \n        case .failure(let error):\n            // failure\n        }\n    }\n    ```\n    \n8. Screen share (view only):\n\n    ```swift\n    spark.phone.dial(\"coworker@acm.com\", option: MediaOption.audioVideoScreenShare(video: (local: ..., remote: ...))) { ret in\n        switch ret {\n        case .success(let call):\n            call.onConnected = {\n                // ...\n            }\n            call.onDisconnected = { reason in\n                // ...\n            }\n            call.onMediaChanged = { changed in\n                switch changed {\n                    ...\n                case .remoteSendingScreenShare(let sending):\n                    call.screenShareRenderView = sending ? view : nil\n                }\n            }\n        case .failure(let error):\n            // failure\n        }\n    }\n    ```\n9. Post a message:\n    ```\n    spark.messages.post(personEmail: email, text: \"Hello there\") { response in\n        switch response.result {\n        case .success(let message):\n            // ...\n        case .failure(let error):\n            // ...\n        }\n    }\n    ```\n10. Receive a message:\n    ```\n    spark.messages.onEvent = { messageEvent in\n        switch messageEvent{\n        case .messageReceived(let message):\n            // ...\n            break\n        case .messageDeleted(let messageId):\n            // ...\n            break\n        }\n    }\n    ```\n11. Screen share (sending):\n\n    11.1 In your containing app:\n    ```swift\n    spark.phone.dial(\"coworker@acm.com\", option: MediaOption.audioVideoScreenShare(video: ..., screenShare: ..., applicationGroupIdentifier: \"group.your.application.group.identifier\"))) { ret in\n        switch ret {\n        case .success(let call):\n            call.oniOSBroadcastingChanged = {\n                event in\n                if #available(iOS 11.2, *) {\n                    switch event {\n                    case .extensionConnected :\n                        call.startSharing() {\n                            error in\n                            // ...\n                        }\n                        break\n                    case .extensionDisconnected:\n                        call.stopSharing() {\n                            error in\n                            // ...\n                        }\n                        break\n                    }\n                }\n            }\n            }\n        case .failure(let error):\n            // failure\n        }\n    }\n    ```\n    11.2 In your broadcast upload extension sample handler:\n    ```swift\n    override func broadcastStarted(withSetupInfo setupInfo: [String : NSObject]?) {\n        // User has requested to start the broadcast. Setup info from the UI extension can be supplied but optional.\n        SparkBroadcastExtension.sharedInstance.start(applicationGroupIdentifier: \"group.your.application.group.identifier\") {\n            error in\n            if let sparkError = error {\n               // ...\n            } else {\n                SparkBroadcastExtension.sharedInstance.onError = {\n                    error in\n                    // ...\n                }\n                SparkBroadcastExtension.sharedInstance.onStateChange = {\n                    state in\n                    // state change\n                }\n            }\n        }\n    }\n    \n    override func broadcastFinished() {\n        // User has requested to finish the broadcast.\n        SparkBroadcastExtension.sharedInstance.finish()\n    }\n    \n    override func processSampleBuffer(_ sampleBuffer: CMSampleBuffer, with sampleBufferType: RPSampleBufferType) {\n        switch sampleBufferType {\n            case RPSampleBufferType.video:\n                // Handle video sample buffer\n                SparkBroadcastExtension.sharedInstance.handleVideoSampleBuffer(sampleBuffer: sampleBuffer)\n                break\n            case RPSampleBufferType.audioApp:\n                // Handle audio sample buffer for app audio\n                break\n            case RPSampleBufferType.audioMic:\n                // Handle audio sample buffer for mic audio\n                break\n        }\n    }\n    ```\n    11.3 Get more technical details about the [Containing App \u0026 Broadcast upload extension](https://github.com/webex/spark-ios-sdk/wiki/Implementation-Broadcast-upload-extension) and [Set up an App Group](https://github.com/webex/spark-ios-sdk/wiki/Set-up-an-App-Group)\n\n## Upgrade SDK 1.3.1 to 1.4.0 Breaking Changes\n\n1. Minimum Deployment Target: ~~8.0~~ =\u003e 10.0\n2. Support Swift Language Version: ~~3.0~~ =\u003e 4.0\n3. If you were using 'MediaRenderView', need to add \"import SparkSDK\". \n4. If you were using 'MediaRenderView' class in storyboard, set the view's module to 'SparkSDK'.\n\n## License\n\n\u0026copy; 2016-2018 Cisco Systems, Inc. and/or its affiliates. All Rights Reserved.\n\nSee [LICENSE](https://github.com/ciscospark/spark-ios-sdk/blob/master/LICENSE) for details.\n","funding_links":[],"categories":["Client SDKs"],"sub_categories":["Advanced APIs"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebex%2Fspark-ios-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebex%2Fspark-ios-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebex%2Fspark-ios-sdk/lists"}