- 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)
}
推薦閱讀
- FuelPHP Application Development Blueprints
- Docker技術入門與實戰(zhàn)(第3版)
- 騰訊iOS測試實踐
- Maven Build Customization
- JavaScript by Example
- 面向對象程序設計(Java版)
- Amazon S3 Cookbook
- HDInsight Essentials(Second Edition)
- Linux Device Drivers Development
- Android開發(fā):從0到1 (清華開發(fā)者書庫)
- 愛上micro:bit
- JavaScript動態(tài)網頁編程
- C語言程序設計教程
- Mastering ASP.NET Web API
- Spring Boot 3:入門與應用實戰(zhàn)