Swift

インターフェイスの構築

アプリの接続ステータスを表示できるようにするには、以下のように UILabel 要素をスクリーンに開く ViewController.swift そして、ファイルの内容全体を以下のように置き換えて、ラベルをプログラムで追加する:

import UIKit
import VonageClientSDKVoice

class ViewController: UIViewController {

    let connectionStatusLabel = UILabel()
    
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view.
        
        connectionStatusLabel.text = "Disconnected"
        connectionStatusLabel.textAlignment = .center
        connectionStatusLabel.translatesAutoresizingMaskIntoConstraints = false
        
        view.addSubview(connectionStatusLabel)
        
        NSLayoutConstraint.activate([
            connectionStatusLabel.centerXAnchor.constraint(equalTo: view.centerXAnchor),
            connectionStatusLabel.centerYAnchor.constraint(equalTo: view.centerYAnchor)
        ])
    }
}

ビルド&ラン

プロジェクトを再度実行する (Cmd + R)を使ってシミュレーターで起動します。

Interface