Migration Guide: iOS Chat SDK (v1.7.1 to v1.8.0)
This guide provides an overview of the key changes in v1.8.0 of the LikeMinds chat iOS SDK and instructions for updating your project from v1.7.1 or below.
Key Updates
- Changes to LMCoreComponents
LMCoreComponents.shared.groupChatFeedScreen
changed toLMCoreComponents.shared.communityChatScreen
LMCoreComponents.shared.chatFeedScreen
changed toLMCoreComponents.shared.communityHybridChatScreen
LMCoreComponents.shared.dmChatFeedScreen
changed toLMCoreComponents.shared.networkingChatScreen
Migration Steps
Step 1. Upgrade the LikeMindsChatCore package in podfile to the below version
platform :ios, '13.0'
target 'YourProjectName' do
use_frameworks!
pod 'LikeMindsChatCore', '~> 1.8.0'
end
Step 2: Install the updated pods
pod install
Step 3: Update Chat Initialization Code
Replace your existing chat initialization code with one of the new theme-specific implementations:
- Community Chat
- Networking Chat
- Community Hybrid Chat
import LikeMindsChatCore
let username = "USER_NAME"
let uuid = "USER_UUID"
let apiKey = "YOUR API KEY"
try? LMChatCore.shared.showChat(apiKey: apiKey, username: username, userId: userId) { [weak self] result in
switch result {
case .success:
do {
let chatFeedVC = try LMCommunityChatViewModel.createModule()
self?.navigationController?.pushViewController(chatFeedVC, animated: true)
} catch {
let alert = UIAlertController(
title: "Error",
message: "Failed to open chat: \(error.localizedDescription)",
preferredStyle: .alert
)
alert.addAction(UIAlertAction(title: "OK", style: .default))
self?.present(alert, animated: true)
}
case .failure(let error):
let alert = UIAlertController(title: "Error", message: error.localizedDescription, preferredStyle: .alert)
alert.addAction(.init(title: "OK", style: .default))
self?.present(alert, animated: true)
return
}
}
import LikeMindsChatCore
let username = "USER_NAME"
let uuid = "USER_UUID"
let apiKey = "YOUR API KEY"
try? LMChatCore.shared.showChat(apiKey: apiKey, username: username, userId: userId) { [weak self] result in
switch result {
case .success:
do {
let chatFeedVC = try LMNetworkingChatViewModel.createModule()
self?.navigationController?.pushViewController(chatFeedVC, animated: true)
} catch {
let alert = UIAlertController(
title: "Error",
message: "Failed to open chat: \(error.localizedDescription)",
preferredStyle: .alert
)
alert.addAction(UIAlertAction(title: "OK", style: .default))
self?.present(alert, animated: true)
}
case .failure(let error):
let alert = UIAlertController(title: "Error", message: error.localizedDescription, preferredStyle: .alert)
alert.addAction(.init(title: "OK", style: .default))
self?.present(alert, animated: true)
return
}
}
import LikeMindsChatCore
let username = "USER_NAME"
let uuid = "USER_UUID"
let apiKey = "YOUR API KEY"
try? LMChatCore.shared.showChat(apiKey: apiKey, username: username, userId: userId) { [weak self] result in
switch result {
case .success:
do {
let chatFeedVC = try LMCommunityHybridChatViewModel.createModule()
self?.navigationController?.pushViewController(chatFeedVC, animated: true)
} catch {
let alert = UIAlertController(
title: "Error",
message: "Failed to open chat: \(error.localizedDescription)",
preferredStyle: .alert
)
alert.addAction(UIAlertAction(title: "OK", style: .default))
self?.present(alert, animated: true)
}
case .failure(let error):
let alert = UIAlertController(title: "Error", message: error.localizedDescription, preferredStyle: .alert)
alert.addAction(.init(title: "OK", style: .default))
self?.present(alert, animated: true)
return
}
}
Step 4: Update LMCoreComponents References
Replace all instances of the old component names with the new ones:
- Community Chat
- Networking Chat
- Community Hybrid Chat
// Old
LMCoreComponents.shared.groupChatFeedScreen
// New
LMCoreComponents.shared.communityChatScreen
// Old
LMCoreComponents.shared.dmChatFeedScreen
// New
LMCoreComponents.shared.networkingChatScreen
// Old
LMCoreComponents.shared.chatFeedScreen
// New
LMCoreComponents.shared.communityHybridChatScreen
By following these steps, you can migrate seamlessly to v1.8.0 and take advantage newly introduced features and customizations.