# Showing chat ## Check chat availability Before you show the chat, you should first check to see if it's available. To check if the chat is available for use, you can use the following method: ```swift public enum SinchSDKChatAvailability { /// The Chat is ready to user. case available /// The Chat is not initialized /// Tip: use initialize method to initialize chat. case uninitialized /// The chat is not authorized /// Tip: User setIdentity method to authorize the client. case authorizationNeeded /// The chat is opened /// You cannot run two chats at once. case currentlyRunning } func isChatAvailable() -> SinchSDKChatAvailability ``` ## Showing the chat Before showing the chat, make sure you have initialised this SDK. ### Present chat view controller modally ```swift do { let options = GetChatViewControllerOptions(metadata: [], shouldInitializeConversation: true) let chatViewController = try SinchChatSDK.shared.chat.getChatViewController(uiConfig: .defaultValue, localizationConfig: .defaultValue, options: options) let navigationController = UINavigationController(rootViewController: chatViewController) navigationController.modalPresentationStyle = .fullScreen self?.present(navigationController, animated: true, completion: nil) } catch { // all errors are related with bad configuration. You can check if chat is available using `isChatAvailable` method. }} ``` ### Programmatically push chat view controller onto the current navigation stack ```swift do { let options = GetChatViewControllerOptions(metadata: [], shouldInitializeConversation: true) let chatViewController = try SinchChatSDK.shared.chat.getChatViewController(uiConfig: .defaultValue, localizationConfig: .defaultValue, options: options) self.navigationItem.backBarButtonItem = UIBarButtonItem(title: "", style: .plain, target: nil, action: nil) self.navigationController?.pushViewController(viewControler, animated: true) } catch { // all errors are related with bad configuration. You can check if chat is available using `isChatAvailable` method. }} ``` ### Chat options You can set a number of opitions for your chat application: - If you need to create a chat that is connected to (for example) some order, you can use topicID. - If you need to pass metadata to a chat, you can use the metadata parameter. - If the conversation should start when the user enters the chat, set shouldInitializeConversation to `true`. - If you want to send document files as text messages and not as media messages set sendDocumentAsTextMessage to `true`. For example: ```swift let options = GetChatViewControllerOptions(topicID: "{topicID}", metadata: [], shouldInitializeConversation: true, sendDocumentAsTextMessage: true) ``` You may now set up [push notifications]((/docs/sinch-chat/getting-started/ios/push/), if desired.