From 4e980b51abe7523ce9eb0de40db86ebf5d930027 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Thu, 24 Sep 2015 08:48:26 +0200 Subject: [PATCH] RowConvertible documentation --- GRDB/Core/Protocols/RowConvertible.swift | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/GRDB/Core/Protocols/RowConvertible.swift b/GRDB/Core/Protocols/RowConvertible.swift index f831e68c3..6115dbfc3 100644 --- a/GRDB/Core/Protocols/RowConvertible.swift +++ b/GRDB/Core/Protocols/RowConvertible.swift @@ -19,13 +19,25 @@ or single instances: RowConvertible is adopted by Record. */ public protocol RowConvertible { - /// Create an instance initialized with `row`. + + /** + Create an instance initialized with `row`. + + For performance reasons, the row argument may be reused between several + instance initializations during the iteration of a fetch query. So if you + want to keep the row for later use, make sure to store a copy: + `self.row = row.copy()`. + + - parameter row: A Row. + */ init(row: Row) - /// Do not call this method directly. - /// - /// Types that adopt RowConvertible have an opportunity to complete their - /// initialization. + /** + Do not call this method directly. + + Types that adopt RowConvertible have an opportunity to complete their + initialization. + */ func awakeFromFetch(row: Row) } @@ -38,7 +50,6 @@ extension RowConvertible { // MARK: - Fetching From SelectStatement /** - TODO Fetches a sequence. let statement = db.selectStatement("SELECT * FROM persons")