     }
 }
 
+/// Table view provider specific to an `ORKBooleanQuestionResult` instance.
+class BooleanQuestionResultTableViewProvider: ResultTableViewProvider   {
+    // MARK: ResultTableViewProvider
+    
+    override func resultRowsForSection(section: Int) -> [ResultRow] {
+        let boolResult = result as! ORKBooleanQuestionResult
+        
+        var boolResultDetailText: String?
+        if let booleanAnswer = boolResult.booleanAnswer {
+            boolResultDetailText = booleanAnswer.boolValue ? "true" : "false"
+        }
+        
+        return super.resultRowsForSection(section) + [
+            ResultRow(text: "bool", detail: boolResultDetailText)
+        ]
+    }
+}
+
+/// Table view provider specific to an `ORKChoiceQuestionResult` instance.
+class ChoiceQuestionResultTableViewProvider: ResultTableViewProvider {
+    // MARK: ResultTableViewProvider
+    
+    override func resultRowsForSection(section: Int) -> [ResultRow] {
+        let choiceResult = result as! ORKChoiceQuestionResult
+        
+        return super.resultRowsForSection(section) + [
+            ResultRow(text: "choices", detail: choiceResult.choiceAnswers)
+        ]
+    }
+}
+
+
+/// Table view provider specific to an `ORKDateQuestionResult` instance.
+class DateQuestionResultTableViewProvider: ResultTableViewProvider {
+    // MARK: ResultTableViewProvider
+    
+    override func resultRowsForSection(section: Int) -> [ResultRow] {
+        let questionResult = result as! ORKDateQuestionResult
+        
+        return super.resultRowsForSection(section) + [
+            // The date the user entered.
+            ResultRow(text: "dateAnswer", detail: questionResult.dateAnswer),
+            
+            // The calendar that was used when the date picker was presented.
+            ResultRow(text: "calendar", detail: questionResult.calendar),
+            
+            // The timezone when the user answered.
+            ResultRow(text: "timeZone", detail: questionResult.timeZone)
+        ]
+    }
+}
+
+/// Table view provider specific to an `ORKNumericQuestionResult` instance.
+class NumericQuestionResultTableViewProvider: ResultTableViewProvider {
+    // MARK: ResultTableViewProvider
+    
+    override func resultRowsForSection(section: Int) -> [ResultRow] {
+        let questionResult = result as! ORKNumericQuestionResult
+        
+        return super.resultRowsForSection(section) + [
+            // The numeric value the user entered.
+            ResultRow(text: "numericAnswer", detail: questionResult.numericAnswer),
+
+            // The unit string that was displayed with the numeric value.
+            ResultRow(text: "unit", detail: questionResult.unit)
+        ]
+    }
+}
+
 /// Table view provider specific to an `ORKScaleQuestionResult` instance.
 class ScaleQuestionResultTableViewProvider: ResultTableViewProvider {
     // MARK: ResultTableViewProvider

        `ORKTaskResult` instance).
    */
    switch result {
        case is ORKScaleQuestionResult:
            providerType = ScaleQuestionResultTableViewProvider.self

        case is ORKNumericQuestionResult:
            providerType = NumericQuestionResultTableViewProvider.self

        case is ORKTimeOfDayQuestionResult:
            providerType = TimeOfDayQuestionResultTableViewProvider.self

        case is ORKDateQuestionResult:
            providerType = DateQuestionResultTableViewProvider.self

        case is ORKTimeIntervalQuestionResult:
            providerType = TimeIntervalQuestionResultTableViewProvider.self

        case is ORKTextQuestionResult:
            providerType = TextQuestionResultTableViewProvider.self

        case is ORKChoiceQuestionResult:
            providerType = ChoiceQuestionResultTableViewProvider.self

        case is ORKBooleanQuestionResult:
            providerType = BooleanQuestionResultTableViewProvider.self

        case is ORKTappingIntervalResult:
            providerType = TappingIntervalResultTableViewProvider.self

        case is ORKSpatialSpanMemoryResult:
            providerType = SpatialSpanMemoryResultTableViewProvider.self
        
        case is ORKReactionTimeResult:
            providerType = ReactionTimeViewProvider.self
        
        case is ORKFileResult:
            providerType = FileResultTableViewProvider.self

        case is ORKConsentSignatureResult:
            providerType = ConsentSignatureResultTableViewProvider.self

        case is ORKTaskResult:
            providerType = TaskResultTableViewProvider.self
        
        case is ORKToneAudiometryResult:
            providerType = ToneAudiometryResultTableViewProvider.self
        
        case is ORKTowerOfHanoiResult:
            providerType = TowerOfHanoiResultTableViewProvider.self
            
        case is ORKTimedWalkResult:
            providerType = TimedWalkResultTableViewProvider.self

        case is ORKToneAudiometryResult:
            providerType = ToneAudiometryResultTableViewProvider.self

        case is ORKPSATResult:
            providerType = PSATResultTableViewProvider.self

        /*
            Refer to the comment near the switch statement for why the
            additional guard is here.
        */
        case is ORKCollectionResult where !(result is ORKTaskResult):
            providerType = CollectionResultTableViewProvider.self


        /*
            Refer to the comment near the switch statement for why the
            additional guard is here.
        */
        case is ORKCollectionResult where !(result is ORKTaskResult):
            providerType = CollectionResultTableViewProvider.self

        default:
            fatalError("No ResultTableViewProvider defined for \(result.dynamicType).")
    }
    
    // Return a new instance of the specific `ResultTableViewProvider`.

    }
}

/// Table view provider specific to an `ORKConsentSignatureResult` instance.
class ConsentSignatureResultTableViewProvider: ResultTableViewProvider {
    // MARK: ResultTableViewProvider
    
    override func resultRowsForSection(section: Int) -> [ResultRow] {
        let signatureResult = result as! ORKConsentSignatureResult
        let signature = signatureResult.signature!
        
        return super.resultRowsForSection(section) + [
            /*
            The identifier for the signature, identifying which one it is in
            the document.
            */
            ResultRow(text: "identifier", detail: signature.identifier),
            
            /*
            The title of the signatory, displayed under the line. For
            example, "Participant".
            */
            ResultRow(text: "title", detail: signature.title),
            
            // The given name of the signatory.
            ResultRow(text: "givenName", detail: signature.givenName),
            
            // The family name of the signatory.
            ResultRow(text: "familyName", detail: signature.familyName),
            
            // The date the signature was obtained.
            ResultRow(text: "date", detail: signature.signatureDate),
            
            // The captured image.
            .TextImage("signature", image: signature.signatureImage)
        ]
    }
    
    func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
        let lastRow = self.tableView(tableView, numberOfRowsInSection: indexPath.section) - 1
        
        if indexPath.row == lastRow {
            return 200
        }
        
        return UITableViewAutomaticDimension
    }
}

/// Table view provider specific to an `ORKFileResult` instance.
class FileResultTableViewProvider: ResultTableViewProvider {
    // MARK: ResultTableViewProvider
    
    override func resultRowsForSection(section: Int) -> [ResultRow] {
        let questionResult = result as! ORKFileResult
        
        let rows = super.resultRowsForSection(section) + [
            // The MIME content type for the file produced.
            ResultRow(text: "contentType", detail: questionResult.contentType),
            
            // The URL of the generated file on disk.
            ResultRow(text: "fileURL", detail: questionResult.fileURL)
        ]
        
        if let fileURL = questionResult.fileURL, let contentType = questionResult.contentType where contentType.hasPrefix("image/") {
            if let data = NSData(contentsOfURL: fileURL), let image = UIImage(data: data) {
                return rows + [
                    // The image of the generated file on disk.
                    .Image(image)
                ]
            }
        }
        
        return rows
    }
    
    func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
        let resultRows = resultRowsForSection(indexPath.section)
        
        if !resultRows.isEmpty {
            switch resultRows[indexPath.row] {
            case .Image(.Some(let image)):
                // Keep the aspect ratio the same.
                let imageAspectRatio = image.size.width / image.size.height
                
                return tableView.frame.size.width / imageAspectRatio
                
            default:
                break
            }
        }
        
        return UITableViewAutomaticDimension
    }
}

