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

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)
}
主站蜘蛛池模板: 通化市| 洪雅县| 德保县| 云龙县| 元阳县| 城步| 新巴尔虎左旗| 武乡县| 南城县| 湾仔区| 临猗县| 奇台县| 潮州市| 黑河市| 商洛市| 枣强县| 白朗县| 英德市| 固镇县| 安徽省| 泽库县| 横峰县| 红桥区| 长岛县| 仲巴县| 和平区| 鄱阳县| 封丘县| 淳化县| 鄂伦春自治旗| 黔东| 靖江市| 习水县| 冀州市| 米泉市| 南华县| 金沙县| 张北县| 巨鹿县| 临城县| 泽州县|