Skip to content

Instantly share code, notes, and snippets.

@rorodriguez116
Last active April 27, 2020 17:50
Show Gist options
  • Save rorodriguez116/2445f1e6b91c6ff5be3ff490b802708f to your computer and use it in GitHub Desktop.
Save rorodriguez116/2445f1e6b91c6ff5be3ff490b802708f to your computer and use it in GitHub Desktop.
SendMessageUseCase example
import Foundation
struct Message {
var id: String
var recieverId: String
var senderId: String
var content: String
}
protocol MessageRepository {
func add(message: Message, completion: () -> ())
}
struct SendMessageUseCase {
let messageRepo: MessageRepository
func execute(message: Message, completion: @escaping () -> ()) {
self.messageRepo.add(message: Message, completion: completion)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment