Cannot find type 'SessionHandler' in scope

we have integrated Amity swift uikit , we tried to manage session but finding issue
and already import AmitySDK, import AmityUIKit, i tried your sample app in which it is working , and SessionHandler finds in AmitySDK, in our app AmitySDK , we don’t find it.

Cannot find type ‘SessionHandler’ in scope

Hello @Raj, please try replacing the below code and let us know if you still facing the issue.

import AmitySDK
import UIKit
import UserNotifications
class ViewController: UIViewController {
    let client = try! AmityClient(apiKey: "Put your apikey here", region: .EU)
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        // Create a button for setup
        let setupButton = UIButton(frame: CGRect(x: 100, y: 100, width: 200, height: 50))
        setupButton.backgroundColor = .blue
        setupButton.setTitle("Setup", for: .normal)
        setupButton.addTarget(self, action: #selector(setupAction), for: .touchUpInside)
        self.view.addSubview(setupButton)
        
        // Create a button for login
        let loginButton = UIButton(frame: CGRect(x: 100, y: 200, width: 200, height: 50))
        loginButton.backgroundColor = .green
        loginButton.setTitle("Login", for: .normal)
        loginButton.addTarget(self, action: #selector(loginAction), for: .touchUpInside)
        self.view.addSubview(loginButton)
        
        // Create a button for registering push notification
        let registerPushNotificationButton = UIButton(frame: CGRect(x: 100, y: 300, width: 200, height: 50))
        registerPushNotificationButton.backgroundColor = .red
        registerPushNotificationButton.setTitle("Register Push", for: .normal)
        registerPushNotificationButton.addTarget(self, action: #selector(registerPushNotificationAction), for: .touchUpInside)
        self.view.addSubview(registerPushNotificationButton)
    }

    @objc func setupAction() {
      
    }

    @objc func loginAction() {
        login()
    }

    @objc func registerPushNotificationAction() async {
        await registerPushNotification()
    }

    func login() {
        Task {
            do {
                try await client.login(
                    userId: "silverhand",
                    displayName: "silverhand",
                    authToken: nil,
                    sessionHandler: MySessionHandler()
                )
                await showAlert(title: "Success", message: "Login successful")
            } catch {
                await showAlert(title: "Error", message: "Login failed: \(error)")
            }
        }
    }

    func registerPushNotification() async {
        do {
            let token = deviceTokenString
            print(token)
            let result = try await client.registerPushNotification(withDeviceToken: "")
            await showAlert(title: "Success", message: "Push notification registration successful")
        } catch {
            await showAlert(title: "Error", message: "Error registering push notification: \(error)")
        }
    }

    @MainActor
    func showAlert(title: String, message: String) async {
        let alert = UIAlertController(title: title, message: message, preferredStyle: .alert)
        alert.addAction(UIAlertAction(title: "OK", style: .default))
        
        if let topController = UIApplication.shared.keyWindow?.rootViewController {
            topController.present(alert, animated: true, completion: nil)
        }
    }



}
class MySessionHandler: SessionHandler {
    func sessionWillRenewAccessToken(renewal: AccessTokenRenewal) {
        renewal.renew()
    }
}

@amitysupport We have tried this code but We could not find class SessionHandler class in AmitySDK and showing error “Cannot find type ‘SessionHandler’ in scope” , while your sample app Amity SDK has this class.
Screenshot 2024-03-06 at 3.14.48 PM

Hello @Raj , After reviewing with our team, we advise you that SwiftUI has been deprecated. Therefore, we recommend using our UIKit as an alternative. Please check the documentation at this link: Amity UIKit iOS Installation Guide.

@amitysupport thanks, installation is done as you suggested , we have created channels (public community), channels joining is working, but UIKit is not showing channels list, we use this code

let chatHomePageVC = AmityChatHomePageViewController.make()
self.navigationController?.pushViewController(chatHomePageVC, animated: true)
(upload://aQvdZ0eo8ofOTXvbWReankiHXvy.png)

Thank you for the update. We will continue to provide assistance in the new topic that your team has created.