官术网_书友最值得收藏!

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)
}
主站蜘蛛池模板: 昌邑市| 大兴区| 德清县| 磐石市| 潜江市| 宕昌县| 根河市| 临澧县| 密云县| 佳木斯市| 西林县| 东城区| 公主岭市| 普兰店市| 全州县| 封开县| 金塔县| 左贡县| 西吉县| 城固县| 凉山| 呼伦贝尔市| 平江县| 高淳县| 鹤庆县| 南岸区| 井冈山市| 肥西县| 垫江县| 平邑县| 徐汇区| 平泉县| 皮山县| 临澧县| 奉化市| 沽源县| 武宣县| 塔河县| 潼南县| 鄯善县| 巢湖市|