- 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)
}
推薦閱讀
- 零基礎學Visual C++第3版
- 移動UI設計(微課版)
- OpenCV實例精解
- Mastering Spring MVC 4
- Python高效開發實戰:Django、Tornado、Flask、Twisted(第3版)
- Symfony2 Essentials
- Creating Mobile Apps with jQuery Mobile(Second Edition)
- Spring技術內幕:深入解析Spring架構與設計原理(第2版)
- 智能手機故障檢測與維修從入門到精通
- 深入理解BootLoader
- Building Slack Bots
- Web編程基礎:HTML5、CSS3、JavaScript(第2版)
- JavaScript Concurrency
- C語言從入門到精通(第5版)
- Spring MVC Cookbook