Classes

The following classes are available globally.

  • A data type represents a local file.

    Since

    1.4.0
    See more

    Declaration

    Swift

    public class LocalFile
  • An iOS client wrapper of the Cisco Spark Message APIs.

    Since

    1.4.0
    See more

    Declaration

    Swift

    public class MessageClient
  • A Call represents a media call on Cisco Spark.

    The application can create an outgoing call by calling phone.dial function:

        let address = "coworker@example.com"
        let localVideoView = MediaRenderView()
        let remoteVideoView = MediaRenderView()
        let mediaOption = MediaOption.audioVideo(local: localVideoView, remote: remoteVideoView)
        spark.phone.dial(address, option:mediaOption) {
          switch ret {
          case .success(let call):
            // success
            call.onConnected = {
    
            }
            call.onDisconnected = { reason in
    
            }
          case .failure(let error):
            // failure
          }
        }
    

    The application can receive an incoming call on phone.onIncoming function:

        spark.phone.onIncoming = { call in
          call.answer(option: mediaOption) { error in
            if let error = error {
              // success
            }
            else {
              // failure
            }
          }
        }
    

    See

    see Phone API about how to create calls.

    See

    CallStatus for the states and transitions of a Call.

    Since

    1.2.0
    See more

    Declaration

    Swift

    public class Call
  • Phone represents a Cisco Spark calling device. The application can obtain a phone object from Spark object and use phone to call other Cisco Spark users or PSTN when enabled. The phone must be registered before it can make or receive calls.

        spark.phone.register() { error in
          if let error = error {
            ... // Device was not registered, and no calls can be sent or received
          } else {
            ... // Successfully registered device
          }
        }
    

    Since

    1.2.0
    See more

    Declaration

    Swift

    public class Phone
  • Spark object is the entry point to use this Cisco Spark iOS SDK. A Spark object must be created with one of the following Authenticator.

    • OAuthAuthenticator - this should be used when the SDK is to be authenticated as a registered user to Cisco Spark cloud.
       let clientId = "Def123456..."
       let clientSecret = "fed456..."
       let scope = "spark:all"
       let redirectUri = "MyCustomApplication://response"
       let authenticator = OAuthAuthenticator(clientId: clientId, clientSecret: clientSecret, scope: scope, redirectUri: redirectUri)
       let spark = Spark(authenticator: authenticator)
       ...
       if !authenticator.authorized {
         authenticator.authorize(parentViewController: self) { success in
           if !success {
               print("User not authorized")
           }
         }
       }
    
    • JWTAuthenticator - this should be used when the SDK is to be authenticated as a guest user to Cisco Spark cloud.
       let authenticator = JWTAuthenticator()
       let spark = Spark(authenticator: authenticator)
       ...
       if !authenticator.authorized {
         authenticator.authorizedWith(jwt: myJwt)
       }
    

    Attention

    All APIs on Cisco Spark iOS SDK are expected to run on the application’s main thread, unless specified otherwise.

    Since

    1.2.0
    See more

    Declaration

    Swift

    public class Spark
  • A data type represents an email address with validation and equatable implementation.

    Since

    1.2.0
    See more

    Declaration

    Swift

    open class EmailAddress