Last active
April 27, 2020 17:50
-
-
Save rorodriguez116/2445f1e6b91c6ff5be3ff490b802708f to your computer and use it in GitHub Desktop.
SendMessageUseCase example
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
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