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

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)
}
主站蜘蛛池模板: 泗阳县| 拜城县| 济宁市| 阳朔县| 宜春市| 沂水县| 绩溪县| 平陆县| 麻江县| 长垣县| 葵青区| 天峨县| 翼城县| 大邑县| 依安县| 蒙自县| 巴彦县| 玛曲县| 灌南县| 鲁甸县| 平乡县| 江山市| 洛浦县| 无为县| 荔波县| 五莲县| 麻江县| 淮滨县| 郓城县| 瑞金市| 汝南县| 永修县| 武陟县| 霍山县| 敖汉旗| 屏边| 奉贤区| 建平县| 彭山县| 邵东县| 吉木乃县|