- Swift 4 Programming Cookbook
- Keith Moon
- 96字
- 2021-07-08 10:21:30
How to do it...
In the last recipe, we added a method to our Person class to save it to a remote database. This is a very useful functionality, and as we add more and more features to our app, we will likely have more types where we will want to save instances of that type to a remote database. Let's create a protocol to define how we will interface with anything that can be saved in this way:
protocol Saveable {
var saveNeeded: Bool { get set }
func saveToRemoteDatabase(handler: @escaping (Bool) -> Void)
}
推薦閱讀
- Web應(yīng)用系統(tǒng)開發(fā)實(shí)踐(C#)
- Android和PHP開發(fā)最佳實(shí)踐(第2版)
- Learning Spring 5.0
- Offer來了:Java面試核心知識(shí)點(diǎn)精講(原理篇)
- 秒懂設(shè)計(jì)模式
- Building an RPG with Unity 2018
- 從零開始學(xué)C語言
- Learning AngularJS for .NET Developers
- Clean Code in C#
- SpringBoot從零開始學(xué)(視頻教學(xué)版)
- NGUI for Unity
- VMware vSphere 5.5 Cookbook
- Socket.IO Cookbook
- Java EE互聯(lián)網(wǎng)輕量級(jí)框架整合開發(fā):SSM+Redis+Spring微服務(wù)(上下冊(cè))
- Flask Web開發(fā)實(shí)戰(zhàn):入門、進(jìn)階與原理解析