lundi 25 mars 2019

how to make array include a PDF document

I am new to swift and trying to figure out how to code my array to include a PDF document. I set up a tableView as when a cell is clicked will move to a new detail view controller. I want the new detail controller to display the PDF associated with the cell that was selected. Is there an intelligent way to code this?

I have been struggling with how to code this portion.

import Foundation import UIKit import PDFKit

class State { var title: String var detailText: String var description: String var image: UIImage

```
var document: PDFDocument
```

init(titled: String, detailText: String, imageName: String, description: String, document: String)
{
    self.title = titled
    self.detailText = detailText
    self.description = description
                   ```
    self.document = PDFDocument
                    ```
    if let img = UIImage(named: imageName){
        image = img
    } else {
        image = UIImage(named: "default")!
    }

I am trying to get the code to recognize "document" as a PDFDocument but I get an error:Cannot assign value of type 'PDFDocument.Type' to type 'PDFDocument' where am I going wrong?

Aucun commentaire:

Enregistrer un commentaire