Add package from https://github.com/KopievDev/Eazyshow
First step | Second step |
---|---|
![]() |
![]() |
Token | Account ID |
---|---|
![]() |
![]() |
lazy var assignment = Assignment(parameters: ["account": "95453f64-b803-4495-abd9-9c785590f2fe",
"token": "7157fb3c-268b-4cf9-9988-beb4d2370cda"]) // With Dictionaty
lazy var assignment = Assignment(account: "95453f64-b803-4495-abd9-9c785590f2fe",
token: "7157fb3c-268b-4cf9-9988-beb4d2370cda") // simple initialization without other parameters
lazy var user = User(parameters: ["firstName":"John", "lastName":"Dorian", "id":"2323"]) // With Dictionaty
lazy var user = User(firstName: "John", lastName: "Dorian") // simple initialization without other parameters
3) Create an instance of the Session
class using User, Assignment instances and a connection reference
lazy var session = Session(user: user, assignment: assignment, url: URL(string: "https://stage.verishow.com/client/conference/sdk/ios")!)
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
session.show(from: self)
}
if your ViewController conforms to the SessionDelegate
protocol, then after calling this method, your controller will become the delegate of this session
//MARK: - SessionDelegate -
extension ViewController: SessionDelegate {
func session(_ session: Session, didReceive data: [String : Any]?) {
let resp = data?["name"] as? String ?? "other data format"
print(resp)
if resp == "vsSessionClosed" {
DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
session.close()
}
}
}
}
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>Location please</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Location please</string>
<key>NSDocumentsFolderUsageDescription</key>
<string>DocumentsFolder please</string>
<key>NSCameraUsageDescription</key>
<string>camera please</string>
<key>NSMicrophoneUsageDescription</key>
<string>mic please</string>
session.close()
import UIKit
import Eazyshow
class ViewController: UIViewController {
//MARK: - Required Properties -
private var session: Session!
//MARK: - Lifecycle -
override func viewDidLoad() {
super.viewDidLoad()
setUp()
}
private func setUp() {
let user = User(parameters: ["firstName":"John", "lastName":"Dorian", "id":"2323"])
let agent = Assignment(parameters: ["account": "95453f64-b803-4495-abd9-9c785590f2fe", "token": "7157fb3c-268b-4cf9-9988-beb4d2370cda"])
Assignment(account: "95453f64-b803-4495-abd9-9c785590f2fe", token: "7157fb3c-268b-4cf9-9988-beb4d2370cda")
session = Session(user: user, assignment: agent, url: URL(string: "https://stage.verishow.com/client/conference/sdk/ios")!)
session.isDebug = true
}
@IBAction private func didTap(button: UIButton) {
session.show(from: self)
}
}
//MARK: - SessionDelegate -
extension ViewController: SessionDelegate {
func session(_ session: Session, didReceive data: [String : Any]?) {
let resp = data?["name"] as? String ?? "other data format"
print(resp)
//Если раскомментировать код ниже, экран с сессией закроется после отправки обратной связи
// if resp == "vsFeedbackSent" {
// DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
// session.close()
// }
// }
}
}