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

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)
}
主站蜘蛛池模板: 锡林郭勒盟| 云和县| 开平市| 宝应县| 中江县| 贺兰县| 陵水| 扶余县| 宝清县| 如东县| 邳州市| 屏东市| 通渭县| 东乌| 蓬莱市| 淮南市| 浦北县| 宁阳县| 宣恩县| 徐州市| 剑河县| 宿松县| 荔浦县| 宣城市| 宜良县| 密云县| 东源县| 女性| 霍山县| 古浪县| 克山县| 宣化县| 锡林浩特市| 尼玛县| 横山县| 永清县| 姜堰市| 肥东县| 临漳县| 聂拉木县| 紫云|