Created
August 9, 2020 15:23
-
-
Save Bradysm/79191807718b252dadc7aae5fd94591f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final class ChatRoomViewModel: ObservableObject { | |
/// service used to send message to chat room | |
private let messagingService: MessageSendable | |
/// username of current user of application | |
private(set) var username: String | |
/// current message typed in view | |
@Published var typedMessage = "" | |
/// message to display to user upon error | |
@Published var errorMessage: String? = nil | |
/// constructor that injects services used within the view model | |
init(messagingService: MessageSendable, username: String) { | |
self.messagingService = messagingService | |
self.username = username | |
} | |
//MARK - intents | |
//... implementation of intents left out for readability | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment